

*=====================================
*	Table 2
*===================================== 


clear
ssc install estout, replace
ssc install psacalc, replace
ssc install xtbalance, replace
ssc install xtabond2, replace
ssc install grstyle, replace
ssc install coefplot, replace
ssc install weakivtest, replace
ssc install avar, replace
ssc install outreg2, replace 
ssc install plausexog, replace

cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data" 
use "Industrialization and democracy final data (with variables recoded)"


/* Subsetting to 5 year intervals */
gen time = 0 if year==1845
replace time = 1 if year==1850
replace time = 2 if year==1855
replace time = 3 if year==1860
replace time = 4 if year==1865
replace time = 5 if year==1870
replace time = 6 if year==1875
replace time = 7 if year==1880
replace time = 8 if year==1885
replace time = 9 if year==1890
replace time = 10 if year==1895
replace time = 11 if year==1900
replace time = 12 if year==1905
replace time = 13 if year==1910
replace time = 14 if year==1915
replace time = 15 if year==1920
replace time = 16 if year==1925
replace time = 17 if year==1930
replace time = 18 if year==1935
replace time = 19 if year==1940
replace time = 20 if year==1945
replace time = 21 if year==1950
replace time = 22 if year==1955
replace time = 23 if year==1960
replace time = 24 if year==1965
replace time = 25 if year==1970
replace time = 26 if year==1975
replace time = 27 if year==1980
replace time = 28 if year==1985
replace time = 29 if year==1990
replace time = 30 if year==1995
replace time = 31 if year==2000
replace time = 32 if year==2005
replace time = 33 if year==2010
replace time = 34 if year==2015

keep if time!=.

tsset id time

egen std_indust = std(indust)
egen std_gini = std(gini)
egen std_years_edu = std(years_edu)
egen std_vdem_equality = std(v2xeg_eqdr)
egen std_ln_gdp = std(ln_gdp)
egen std_urbanization = std(urbanization)
egen std_oil_gdp = std(oil_gdp)
egen std_region_vdem_lib = std(region_vdem_lib)
egen std_trade = std(trade)
egen std_property_rights = std(property_rights )
egen std_breakdowns = std(e_democracy_breakdowns)
egen std_duration_regime = std(duration_regime)
egen std_state_ownership = std(state_ownership)
egen std_gdp_growth = std(gdp_growth)
egen std_pop_15_64 = std(pop_15_64)
gen ln_pop_15_65 = ln(pop_15_64)
egen std_ln_pop_15_65 = std(ln_pop_15_65)
egen std_political_cor = std(political_cor)
egen std_mva_gdp = std(mva_gdp)
egen std_min_empl = std(min_empl)
egen std_literacy = std(literacy)
gen ln_pop = ln(pop)
egen std_ln_pop = std(ln_pop)

gen l1_std_indust = l.std_indust

estimates clear

** Column 1 -- Bivariate
quietly: eststo sr_m1: xtreg vdem_elec l.vdem_elec l1_std_indust i.time if sovereign2==1, fe robust
quietly: eststo lr_m1: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

** Column 2 -- GDP per capita and inequality
quietly: eststo sr_m2: xtreg vdem_elec l.vdem_elec l1_std_indust l.std_vdem_equality l.std_ln_gdp l.std_years_edu l.std_urbanization i.time if sovereign2==1, fe robust
quietly: eststo delta_m2: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)
quietly: eststo lr_m2: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

** Column 3 -- Oil rents, and democracy in the region
quietly: eststo sr_m3: xtreg vdem_elec l.vdem_elec l1_std_indust l1.std_oil_gdp l1.std_breakdowns l1.recession i.time if sovereign2==1, fe robust
quietly: eststo delta_m3: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)
quietly: eststo lr_m3: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

** Column 4 -- Trade and past reversals
quietly: eststo sr_m4: xtreg vdem_elec l.vdem_elec l1_std_indust l1.std_duration_regime l1.std_property_rights l1.std_trade i.time if sovereign2==1, fe robust
quietly: eststo delta_m4: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)
quietly: eststo lr_m4: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

** Column 5 --  Western alignment and warfare
quietly: eststo sr_m5: xtreg vdem_elec l.vdem_elec l1_std_indust l1.democracy_after_autconst l1.std_state_ownership l1.std_political_cor i.time if sovereign2==1, fe robust
quietly: eststo delta_m5: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)
quietly: eststo lr_m5: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

** Column 6 -- Duration regime, GDP growth, and state ownership
quietly: eststo sr_m6: xtreg vdem_elec l.vdem_elec l1_std_indust l1.western_align l1.inter_war l1.intra_war i.time if sovereign2==1, fe robust
quietly: eststo delta_m6: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)
quietly: eststo lr_m6: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

estout sr_m1 sr_m2 sr_m3 sr_m4 sr_m5 sr_m6, cells(b(star fmt(3)) se(par fmt(3))) legend stats(oster_delta N N_g, fmt(%7.1f %7.0f %7.0f)) starlevels(* 0.05 ** 0.01 *** 0.001) drop(*time*) 
estout delta_m2 delta_m3 delta_m4 delta_m5 delta_m6, legend label stats(delta, fmt(%7.1f)) keep(*_cons*)
estout lr_m1 lr_m2 lr_m3 lr_m4 lr_m5 lr_m6, cells(b(star fmt(3)) se(par fmt(3))) starlevels(* 0.05 ** 0.01 *** 0.001) legend label 


*=====================================
*	Figure 1
*=====================================

clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

/* Subsetting to 5 year intervals */
gen time = 0 if year==1845
replace time = 1 if year==1850
replace time = 2 if year==1855
replace time = 3 if year==1860
replace time = 4 if year==1865
replace time = 5 if year==1870
replace time = 6 if year==1875
replace time = 7 if year==1880
replace time = 8 if year==1885
replace time = 9 if year==1890
replace time = 10 if year==1895
replace time = 11 if year==1900
replace time = 12 if year==1905
replace time = 13 if year==1910
replace time = 14 if year==1915
replace time = 15 if year==1920
replace time = 16 if year==1925
replace time = 17 if year==1930
replace time = 18 if year==1935
replace time = 19 if year==1940
replace time = 20 if year==1945
replace time = 21 if year==1950
replace time = 22 if year==1955
replace time = 23 if year==1960
replace time = 24 if year==1965
replace time = 25 if year==1970
replace time = 26 if year==1975
replace time = 27 if year==1980
replace time = 28 if year==1985
replace time = 29 if year==1990
replace time = 30 if year==1995
replace time = 31 if year==2000
replace time = 32 if year==2005
replace time = 33 if year==2010
replace time = 34 if year==2015

keep if time!=.

tsset id time

estimates clear

egen std_indust = std(indust)


** Excluding Scandinavia
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1 & scandinavia==0, fe robust
quietly: eststo excl_scandinavia: nlcom (excl_scandinavia: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding North-West Europe
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1 & north_west_europe==0, fe robust
quietly: eststo excl_north_west_europe: nlcom (excl_north_west_europe: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding Southern Europe
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1 & southern_europe==0, fe robust
quietly: eststo excl_southern_europe: nlcom (excl_southern_europe: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding UK and british offshoots
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1 & british_offshoots==0, fe robust
quietly: eststo excl_british_offshoots: nlcom (excl_british_offshoots: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding Eastern Europe
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1 & eastern_europe==0, fe robust
quietly: eststo excl_eastern_europe: nlcom (excl_eastern_europe: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding Balkan
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1 & balkans==0, fe robust
quietly: eststo excl_balkan: nlcom (excl_balkan: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding ex-USSR
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1 & ex_ussr==0, fe robust
quietly: eststo excl_ex_ussr: nlcom (excl_ex_ussr: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding South America
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1 & south_america==0, fe robust
quietly: eststo excl_south_america: nlcom (excl_south_america: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding Central America
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1 & central_america==0, fe robust
quietly: eststo excl_central_america: nlcom (excl_central_america: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding North Africa
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1 & north_africa==0, fe robust
quietly: eststo excl_north_africa: nlcom (excl_north_africa: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding Middle East
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1 & middle_east==0, fe robust
quietly: eststo excl_middle_east: nlcom (excl_middle_east: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding SSA
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1 & e_region_world_2!=4, fe robust
quietly: eststo excl_ssa: nlcom (excl_ssa: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding East Asia
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1 & e_region_world_2!=6, fe robust
quietly: eststo excl_east_asia: nlcom (excl_east_asia: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding Southeast Asia
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1 & e_region_world_2!=7, fe robust
quietly: eststo excl_southeast_asia: nlcom (excl_southeast_asia: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding South Asia
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1 & e_region_world_2!=8, fe robust
quietly: eststo excl_south_asia: nlcom (excl_south_asia: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding Pacific
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1 & e_region_world_2!=9, fe robust
quietly: eststo excl_pacific: nlcom (excl_pacific: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding Carribean
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1 & e_region_world_2!=9, fe robust
quietly: eststo excl_carribean: nlcom (excl_carribean: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Balanced sample (1960-2000)
clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

tsset id year
gen l1_vdem_elec = l.vdem_elec
gen l1_indust = l.indust
xtbalance , range(1960 2000) miss(vdem_elec l1_vdem_elec l1_indust)

gen time = 0 if year==1845
replace time = 1 if year==1960
replace time = 2 if year==1965
replace time = 3 if year==1970
replace time = 4 if year==1975
replace time = 5 if year==1980
replace time = 6 if year==1985
replace time = 7 if year==1990
replace time = 8 if year==1995
replace time = 9 if year==2000

keep if time!=.

tsset id time

egen std_indust = std(indust)


quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1, fe robust
quietly: eststo balanced_1960_2000: nlcom (balanced_1960_2000: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Post-1945

clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

/* Subsetting to 5 year intervals */
gen time = 0 if year==1845
replace time = 1 if year==1850
replace time = 2 if year==1855
replace time = 3 if year==1860
replace time = 4 if year==1865
replace time = 5 if year==1870
replace time = 6 if year==1875
replace time = 7 if year==1880
replace time = 8 if year==1885
replace time = 9 if year==1890
replace time = 10 if year==1895
replace time = 11 if year==1900
replace time = 12 if year==1905
replace time = 13 if year==1910
replace time = 14 if year==1915
replace time = 15 if year==1920
replace time = 16 if year==1925
replace time = 17 if year==1930
replace time = 18 if year==1935
replace time = 19 if year==1940
replace time = 20 if year==1945
replace time = 21 if year==1950
replace time = 22 if year==1955
replace time = 23 if year==1960
replace time = 24 if year==1965
replace time = 25 if year==1970
replace time = 26 if year==1975
replace time = 27 if year==1980
replace time = 28 if year==1985
replace time = 29 if year==1990
replace time = 30 if year==1995
replace time = 31 if year==2000
replace time = 32 if year==2005
replace time = 33 if year==2010
replace time = 34 if year==2015

keep if time!=.

tsset id time

egen std_indust = std(indust)


quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1 & year>=1945, fe robust
quietly: eststo post_1945: nlcom (post_1945: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Post-1975
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1 & year>=1975, fe robust
quietly: eststo post_1975: nlcom (post_1975: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Post-1990
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1 & year>=1989, fe robust
quietly: eststo post_1990: nlcom (post_1990: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Pooled OLS
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1, re robust
quietly: eststo pooled: nlcom (pooled: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** No time FE
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust if sovereign2==1, fe robust
quietly: eststo no_time_fe: nlcom (no_time_fe: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** No lagged DV
quietly: eststo: xtreg vdem_elec l.std_indust i.time if sovereign2==1, fe robust
quietly: eststo no_lag: nlcom (no_lag: _b[l.std_indust]), post

** Global linear time trends
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust time i.time if sovereign2==1, fe robust
quietly: eststo global_trend: nlcom (global_trend: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Continent linear time trends
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust c.time##i.continents i.time if sovereign2==1, fe robust
quietly: eststo continent_trend: nlcom (continent_trend: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Country specific linear time trends
quietly: eststo: reg vdem_elec l.vdem_elec l.std_indust c.time##i.id if sovereign2==1, vce(cluster id)
quietly: eststo country_trend: nlcom (country_trend: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Country specific quadratic time trends
gen time2 = time*time

quietly: eststo: reg vdem_elec l.vdem_elec l.std_indust time c.time2##i.id if sovereign2==1, vce(cluster id)
quietly: eststo quadratic_trend: nlcom (quadratic_trend: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** PCSE ols
quietly: eststo: xtpcse vdem_elec l.vdem_elec l.std_indust i.time i.id if sovereign2==1, pairwise hetonly correlation(psar1)
quietly: eststo pcse: nlcom (pcse: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Difference-GMM
tab time, gen (yr)

quietly: eststo: xtabond2 vdem_elec L.(vdem_elec std_indust) yr* if sovereign2==1, gmm(L.(vdem_elec)) iv(yr*) iv(L2.std_indust) noleveleq robust 
quietly: eststo diff_gmm: nlcom (diff_gmm: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** System-GMM
quietly: eststo: xtabond2 vdem_elec L.(vdem_elec std_indust) yr* if sovereign2==1, gmm(L.(vdem_elec), collapse) iv(yr*) iv(L2.std_indust) robust 
quietly: eststo system_gmm: nlcom (system_gmm: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** V-dem liberal democracy index
quietly: eststo: xtreg vdem_lib l.vdem_lib l.std_indust i.time if sovereign2==1, fe robust
quietly: eststo vdem_lib: nlcom (vdem_lib: _b[l.std_indust]/(1-_b[l.vdem_lib])), post

** Universal suffrage
quietly: eststo: xtreg universal_suffrage l.universal_suffrage l.std_indust i.time if sovereign2==1, fe robust
quietly: eststo universal_suffrage: nlcom (universal_suffrage: _b[l.std_indust]/(1-_b[l.universal_suffrage])), post

** Universal male suffrage
quietly: eststo: xtreg male_suffrage l.male_suffrage l.std_indust i.time if sovereign2==1, fe robust
quietly: eststo male_suffrage: nlcom (male_suffrage: _b[l.std_indust]/(1-_b[l.male_suffrage])), post

** Universal female suffrage
quietly: eststo: xtreg female_suffrage l.female_suffrage l.male_suffrage l.std_indust i.time if sovereign2==1, fe robust
quietly: eststo female_suffrage: nlcom (female_suffrage: _b[l.std_indust]/(1-_b[l.female_suffrage])), post

** Judicial constraints on exective index
quietly: eststo: xtreg judicial_constraints l.judicial_constraints l.std_indust i.time if sovereign2==1, fe robust
quietly: eststo judicial_constraints: nlcom (judicial_constraints: _b[l.std_indust]/(1-_b[l.judicial_constraints])), post

** Combined Polity IV
quietly: eststo: xtreg polity l.polity l.std_indust i.time if sovereign2==1, fe robust
quietly: eststo polity: nlcom (polity: _b[l.std_indust]/(1-_b[l.polity])), post

** Lexical index
quietly: eststo: xtreg lexical l.lexical l.std_indust i.time if sovereign2==1, fe robust
quietly: eststo lexical: nlcom (lexical: _b[l.std_indust]/(1-_b[l.lexical])), post

** Boix et. al. (2013)
quietly: eststo: xtreg boix l.boix l.std_indust i.time if sovereign2==1, fe robust
quietly: eststo boix: nlcom (boix: _b[l.std_indust]/(1-_b[l.boix])), post

** Cheibub et. al. (2010)
quietly: eststo: xtreg cheibub l.cheibub l.std_indust i.time if sovereign2==1, fe robust
quietly: eststo cheibub: nlcom (cheibub: _b[l.std_indust]/(1-_b[l.cheibub])), post

** 1 year, regular intervals
clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

tsset id year

egen std_indust = std(indust)

quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.year if sovereign2==1, fe robust
quietly: eststo intervals_1yr: nlcom (intervals_1yr: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** 5 year, regular intervals

clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

/* Subsetting to 5 year intervals */
gen time = 0 if year==1845
replace time = 1 if year==1850
replace time = 2 if year==1855
replace time = 3 if year==1860
replace time = 4 if year==1865
replace time = 5 if year==1870
replace time = 6 if year==1875
replace time = 7 if year==1880
replace time = 8 if year==1885
replace time = 9 if year==1890
replace time = 10 if year==1895
replace time = 11 if year==1900
replace time = 12 if year==1905
replace time = 13 if year==1910
replace time = 14 if year==1915
replace time = 15 if year==1920
replace time = 16 if year==1925
replace time = 17 if year==1930
replace time = 18 if year==1935
replace time = 19 if year==1940
replace time = 20 if year==1945
replace time = 21 if year==1950
replace time = 22 if year==1955
replace time = 23 if year==1960
replace time = 24 if year==1965
replace time = 25 if year==1970
replace time = 26 if year==1975
replace time = 27 if year==1980
replace time = 28 if year==1985
replace time = 29 if year==1990
replace time = 30 if year==1995
replace time = 31 if year==2000
replace time = 32 if year==2005
replace time = 33 if year==2010
replace time = 34 if year==2015

keep if time!=.

tsset id time

egen std_indust = std(indust)

quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1, fe robust
quietly: eststo intervals_5yr: nlcom (intervals_5yr: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** 10 year, regular intervals
clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

gen time = 0 if year==1845
replace time = 1 if year==1855
replace time = 2 if year==1865
replace time = 3 if year==1875
replace time = 4 if year==1885
replace time = 5 if year==1895
replace time = 6 if year==1905
replace time = 7 if year==1915
replace time = 8 if year==1925
replace time = 9 if year==1935
replace time = 10 if year==1945
replace time = 11 if year==1955
replace time = 12 if year==1965
replace time = 13 if year==1975
replace time = 14 if year==1985
replace time = 15 if year==1995
replace time = 16 if year==2005
replace time = 17 if year==2015

keep if time!=.

tsset id time

egen std_indust = std(indust)

quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1, fe robust
quietly: eststo intervals_10yr: nlcom (intervals_10yr: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** 15 year, regular intervals
clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

gen time = 0 if year==1850
replace time = 1 if year==1865
replace time = 2 if year==1880
replace time = 3 if year==1895
replace time = 4 if year==1910
replace time = 5 if year==1925
replace time = 6 if year==1940
replace time = 7 if year==1955
replace time = 8 if year==1970
replace time = 9 if year==1985
replace time = 10 if year==2000
replace time = 11 if year==2015

keep if time!=.

tsset id time

egen std_indust = std(indust)

quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1, fe robust
quietly: eststo intervals_15yr: nlcom (intervals_15yr: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** 20 year, regular intervals
clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

gen time = 0 if year==1855
replace time = 1 if year==1875
replace time = 2 if year==1895
replace time = 3 if year==1915
replace time = 4 if year==1935
replace time = 5 if year==1955
replace time = 6 if year==1975
replace time = 7 if year==1995
replace time = 8 if year==2015

keep if time!=.

tsset id time

egen std_indust = std(indust)

quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1, fe robust
quietly: eststo intervals_20yr: nlcom (intervals_20yr: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** 25 year, regular intervals
clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

gen time = 0 if year==1865
replace time = 1 if year==1890
replace time = 2 if year==1915
replace time = 3 if year==1940
replace time = 4 if year==1965
replace time = 5 if year==1990
replace time = 6 if year==2015

keep if time!=.

tsset id time

egen std_indust = std(indust)

quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1, fe robust
quietly: eststo intervals_25yr: nlcom (intervals_25yr: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

set scheme   s2mono                     
grstyle init
grstyle set plain, nogrid 

coefplot excl_scandinavia excl_north_west_europe excl_british_offshoots excl_southern_europe excl_eastern_europe excl_balkan excl_ex_ussr excl_north_africa excl_middle_east excl_ssa excl_south_america excl_central_america excl_east_asia excl_southeast_asia excl_south_asia excl_pacific excl_carribean post_1975 post_1945 balanced_1960_2000 global_trend pcse diff_gmm intervals_1yr intervals_5yr intervals_10yr intervals_15yr intervals_20yr intervals_25yr polity lexical boix cheibub universal_suffrage male_suffrage, xline(0) levels(95) nokey msymbol(cicle) mcolor(black) msize(vsmall) lcolor(black) pstyle(p5) mlabel format(%9.2f) mlabposition(2) mlabsize(vsmall) headings(excl_scandinavia="{bf:Excluding:}" post_1975="{bf:Sample:}" global_trend="{bf:Specification:}" intervals_1yr="{bf:Lag length:}" polity="{bf:Alternative democracy indicators:}", labsize(small) labcolor(black)) coeflabels(excl_scandinavia="Scandinavia" excl_north_west_europe="North-West Europe" excl_british_offshoots="UK and British offshoots" excl_southern_europe="Southern Europe" excl_north_africa="North Africa" excl_middle_east="Middle East" excl_south_america="South America"  excl_central_america="Central America" excl_eastern_europe="Eastern Europe" excl_balkan="Balkan" excl_ex_ussr="ex-USSR" excl_ssa="Subsaharan Africa" excl_east_asia="East Asia" excl_southeast_asia="Southeast Asia" excl_south_asia="South Asia" excl_pacific="Pacific" excl_carribean="Carribean" post_1975="Post-1975" post_1945="Post-1945" balanced_1960_2000="Balanced (1960-2000)" global_trend="Time trend, OLS" continent_trend="Continent-specific time trend, OLS"  country_trend="Country-specific time trend, OLS" pcse="PCSE, Prais-Winsten" diff_gmm="Difference-GMM" intervals_1yr="1 year" intervals_5yr="5 year" intervals_10yr="10 year" intervals_15yr="15 year" intervals_20yr="20 year" intervals_25yr="25 year" polity="Combined Polity IV Index (0-10)" vdem_lib="V-dem liberal democracy index (0-10)" universal_suffrage="Universal suffrage (0-1)" male_suffrage= "Male suffrage (0-1)"  polity="Combined Polity IV index (0-10)" lexical="Lexical index (0-6)" boix="Boix et. al. (2013) democracy (0-1)" cheibub="Cheibub et. al. (2010) democracy (0-1)", notick labgap(2) labsize(vsmall))



*=====================================
*	Table 3
*=====================================

clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

/* Subsetting to 5 year intervals */
gen time = 0 if year==1845
replace time = 1 if year==1850
replace time = 2 if year==1855
replace time = 3 if year==1860
replace time = 4 if year==1865
replace time = 5 if year==1870
replace time = 6 if year==1875
replace time = 7 if year==1880
replace time = 8 if year==1885
replace time = 9 if year==1890
replace time = 10 if year==1895
replace time = 11 if year==1900
replace time = 12 if year==1905
replace time = 13 if year==1910
replace time = 14 if year==1915
replace time = 15 if year==1920
replace time = 16 if year==1925
replace time = 17 if year==1930
replace time = 18 if year==1935
replace time = 19 if year==1940
replace time = 20 if year==1945
replace time = 21 if year==1950
replace time = 22 if year==1955
replace time = 23 if year==1960
replace time = 24 if year==1965
replace time = 25 if year==1970
replace time = 26 if year==1975
replace time = 27 if year==1980
replace time = 28 if year==1985
replace time = 29 if year==1990
replace time = 30 if year==1995
replace time = 31 if year==2000
replace time = 32 if year==2005
replace time = 33 if year==2010
replace time = 34 if year==2015

keep if time!=.

tsset id time

egen std_indust = std(indust)
egen std_state_ownership = std(state_ownership)

estimates clear

** Column 1: V-dem electoral democracy index
quietly: eststo sr_m1: xtreg elec_dem_dummy l.c.elec_dem_dummy##l.c.std_indust i.time if sovereign2==1, fe robust
quietly: eststo lr_m1: nlcom (nlx: _b[l.std_indust]/(1-_b[l.elec_dem_dummy])), post

** Column 2: Boix
quietly: eststo sr_m2: xtreg boix l.c.boix##l.c.std_indust i.time if sovereign2==1, fe robust
quietly: eststo lr_m2: nlcom (nlx: _b[l.std_indust]/(1-_b[l.boix])), post

** Column 3: Upturns
by id: gen upturn = vdem_elec 
by id: replace upturn = 0 if vdem_elec<l.vdem_elec

quietly: eststo sr_m3: xtreg upturn l.upturn l.vdem_elec l.std_indust i.time if sovereign2==1, fe robust
quietly: eststo lr_m3: nlcom (nlx: _b[l.std_indust]/(1-_b[l.upturn])), post

** Column 4: Downturns
by id: gen downturn = vdem_elec
by id: replace downturn = 0 if vdem_elec>l.vdem_elec

quietly: eststo sr_m4: xtreg downturn l.downturn l.vdem_elec l.std_indust i.time if sovereign2==1, fe robust
quietly: eststo lr_m4: nlcom (nlx: _b[l.std_indust]/(1-_b[l.downturn])), post

** Column 5: State dependency
quietly: eststo sr_m5: xtreg vdem_elec l.vdem_elec l.c.std_state_ownership##l.c.std_indust i.time if sovereign2==1, fe robust
quietly: eststo lr_m5: nlcom (nlx: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

estout sr_m1 sr_m2 sr_m3 sr_m4 sr_m5, cells(b(star fmt(3)) se(par fmt(3))) legend label stats(N N_g, fmt(%7.0f %7.0f)) starlevels(* 0.05 ** 0.01 *** 0.001) drop(*time*)
estout lr_m1 lr_m2 lr_m3 lr_m4 lr_m5, cells(b(star fmt(3)) se(par fmt(3))) starlevels(* 0.05 ** 0.01 *** 0.001) legend label 

 

*=====================================
*	Table 4
*=====================================

clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

bys id: gen period = 3 * floor(year/3)
collapse vdem_lib vdem_elec polity indust sovereign2 worker_protest, by (id period country_name)

bys id: gen time = _n

tsset id time

xi i.period

gen working_revolt = 0 if worker_protest==0
replace working_revolt = 1 if worker_protest>0
replace working_revolt = . if worker_protest==.

egen std_indust = std(indust)

estimates clear

** Column 1 -- Industrial worker revolt (OLS)
quietly: eststo sr_m1: xtreg l.working_revolt l.vdem_elec l2.working_revolt l.std_indust i.period if sovereign2==1, fe robust

** Column 2 -- Industrial worker revolt on democracy
quietly: eststo sr_m2: xtreg vdem_elec l.vdem_elec l1.working_revolt i.period if sovereign2==1 & std_indust!=., fe robust

** Column 3 -- Industrialization on democracy
quietly: eststo sr_m3, title(OLS): xtreg vdem_elec l.vdem_elec l.std_indust i.period if e(sample)==1, fe robust

** Column 4 -- Industrialization on democracy, while controlling for worker revolt
quietly: eststo sr_m4: xtreg vdem_elec l.vdem_elec l1.working_revolt l1.std_indust i.period if e(sample)==1, fe robust

estout sr_m1 sr_m2 sr_m3 sr_m4, cells(b(star fmt(3)) se(par fmt(3))) legend label stats(N N_g, fmt(%7.0f %7.0f)) drop(*_cons* *period*)


*=====================================
*	Table A4
*===================================== 

clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

/* Creating index */
sum pop_unido pop_ggdc pop_mitchell if pop_unido!=. & pop_ggdc!=. & pop_mitchell!=.

display 6.865825/5.114263
gen pop_unido2 = pop_unido * 1.3424857

display 6.865825/6.897231
gen pop_mitchell2 = pop_mitchell * .99544658

sum pop_unido2 pop_ggdc pop_mitchell2 if pop_unido!=. & pop_ggdc!=. & pop_mitchell!=.

gen indust2 = . 
replace indust2 = pop_ggdc if pop_ggdc!=.
replace indust2 = pop_mitchell2 if indust2==.
replace indust2 = pop_unido2 if indust2==.
sum indust indust2

/* Subsetting to 5 year intervals */
gen time = 0 if year==1845
replace time = 1 if year==1850
replace time = 2 if year==1855
replace time = 3 if year==1860
replace time = 4 if year==1865
replace time = 5 if year==1870
replace time = 6 if year==1875
replace time = 7 if year==1880
replace time = 8 if year==1885
replace time = 9 if year==1890
replace time = 10 if year==1895
replace time = 11 if year==1900
replace time = 12 if year==1905
replace time = 13 if year==1910
replace time = 14 if year==1915
replace time = 15 if year==1920
replace time = 16 if year==1925
replace time = 17 if year==1930
replace time = 18 if year==1935
replace time = 19 if year==1940
replace time = 20 if year==1945
replace time = 21 if year==1950
replace time = 22 if year==1955
replace time = 23 if year==1960
replace time = 24 if year==1965
replace time = 25 if year==1970
replace time = 26 if year==1975
replace time = 27 if year==1980
replace time = 28 if year==1985
replace time = 29 if year==1990
replace time = 30 if year==1995
replace time = 31 if year==2000
replace time = 32 if year==2005
replace time = 33 if year==2010
replace time = 34 if year==2015

keep if time!=.

tsset id time

egen std_indust = std(indust2)
egen std_gini = std(gini)
egen std_years_edu = std(years_edu)
egen std_vdem_equality = std(v2xeg_eqdr)
egen std_ln_gdp = std(ln_gdp)
egen std_urbanization = std(urbanization)
egen std_oil_gdp = std(oil_gdp)
egen std_region_vdem_lib = std(region_vdem_lib)
egen std_trade = std(trade)
egen std_property_rights = std(property_rights )
egen std_breakdowns = std(e_democracy_breakdowns)
egen std_duration_regime = std(duration_regime)
egen std_state_ownership = std(state_ownership)
egen std_gdp_growth = std(gdp_growth)
egen std_pop_15_64 = std(pop_15_64)
gen ln_pop_15_65 = ln(pop_15_64)
egen std_ln_pop_15_65 = std(ln_pop_15_65)
egen std_political_cor = std(political_cor)
egen std_mva_gdp = std(mva_gdp)
egen std_min_empl = std(min_empl)
egen std_literacy = std(literacy)
gen ln_pop = ln(pop)
egen std_ln_pop = std(ln_pop)

gen l1_std_indust = l.std_indust

estimates clear

** Column 1 -- Bivariate
quietly: eststo sr_m1: xtreg vdem_elec l.vdem_elec l1_std_indust i.time if sovereign2==1, fe robust
quietly: eststo lr_m1: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

** Column 2 -- GDP per capita and inequality
quietly: eststo sr_m2: xtreg vdem_elec l.vdem_elec l1_std_indust l.std_vdem_equality l.std_ln_gdp l.std_years_edu l.std_urbanization i.time if sovereign2==1, fe robust
quietly: eststo delta_m2: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)
quietly: eststo lr_m2: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

** Column 3 -- Oil rents, and democracy in the region
quietly: eststo sr_m3: xtreg vdem_elec l.vdem_elec l1_std_indust l1.std_oil_gdp l1.std_breakdowns l1.recession i.time if sovereign2==1, fe robust
quietly: eststo delta_m3: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)
quietly: eststo lr_m3: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

** Column 4 -- Trade and past reversals
quietly: eststo sr_m4: xtreg vdem_elec l.vdem_elec l1_std_indust l1.std_duration_regime l1.std_property_rights l1.std_trade i.time if sovereign2==1, fe robust
quietly: eststo delta_m4: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)
quietly: eststo lr_m4: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

** Column 5 --  Western alignment and warfare
quietly: eststo sr_m5: xtreg vdem_elec l.vdem_elec l1_std_indust l1.democracy_after_autconst l1.std_state_ownership l1.std_political_cor i.time if sovereign2==1, fe robust
quietly: eststo delta_m5: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)
quietly: eststo lr_m5: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

** Column 6 -- Duration regime, GDP growth, and state ownership
quietly: eststo sr_m6: xtreg vdem_elec l.vdem_elec l1_std_indust l1.western_align l1.inter_war l1.intra_war i.time if sovereign2==1, fe robust
quietly: eststo delta_m6: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)
quietly: eststo lr_m6: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

estout sr_m1 sr_m2 sr_m3 sr_m4 sr_m5 sr_m6, cells(b(star fmt(3)) se(par fmt(3))) legend stats(oster_delta N N_g, fmt(%7.1f %7.0f %7.0f)) starlevels(* 0.05 ** 0.01 *** 0.001) drop(*time*) 
estout delta_m2 delta_m3 delta_m4 delta_m5 delta_m6, legend label stats(delta, fmt(%7.1f)) keep(*_cons*)
estout lr_m1 lr_m2 lr_m3 lr_m4 lr_m5 lr_m6, cells(b(star fmt(3)) se(par fmt(3))) starlevels(* 0.05 ** 0.01 *** 0.001) legend label 

*=====================================
*	Merge for replication knutsen
*=====================================


clear

use "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data/Knutsen et. al. An Electoral Connection replication files/2019_EJPR_replication_data.dta", clear

drop if country_name==""

merge 1:1 country_name year using "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data/Industrialization and democracy data ready to use"

egen std_indust = std(indust)
drop if _merge==2


cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data/Knutsen et. al. An Electoral Connection replication files"
save "Knutsen data merged", replace

clear


*=====================================
*	Table A5
*=====================================

use "Knutsen data merged.dta", clear
xtset country_id year
/* 1 */ qui xtreg F.v2x_liberal std_indust v2x_liberal i.year, fe vce(cluster country_id)
outreg2 using Table_1.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle("polity2") addstat("Years", e(g_max)) excel replace
/* 2 */ qui xtreg F.v2x_partip std_indust v2x_partip i.year, fe vce(cluster country_id)
outreg2 using Table_1.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle("partip") addstat("Years", e(g_max)) excel append
/* 3 */ qui xtreg F.v2xdl_delib std_indust v2xdl_delib i.year, fe vce(cluster country_id)
outreg2 using Table_1.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle("delib") addstat("Years", e(g_max)) excel append
/* 4 */ qui xtreg F.v2x_egal std_indust v2x_egal i.year, fe vce(cluster country_id)
outreg2 using Table_1.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle("egal") addstat("Years", e(g_max)) excel append
/* 5 */ qui xtreg F.v2xcl_rol std_indust v2xcl_rol i.year, fe vce(cluster country_id)
outreg2 using Table_1.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle("rol") addstat("Years", e(g_max)) excel append
/* 6 */ qui xtreg F.v2x_jucon std_indust v2x_jucon i.year, fe vce(cluster country_id)
outreg2 using Table_1.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle("jucon") addstat("Years", e(g_max)) excel append
/* 7 */ qui xtreg F.v2xlg_legcon std_indust v2xlg_legcon i.year, fe vce(cluster country_id)
outreg2 using Table_1.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle("legcon") addstat("Years", e(g_max)) excel append
/* 8 */ qui xtreg F.v2x_freexp std_indust v2x_freexp i.year, fe vce(cluster country_id)
outreg2 using Table_1.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle("freexp") addstat("Years", e(g_max)) excel append
/* 9 */ qui xtreg F.v2xme_altinf std_indust v2xme_altinf i.year, fe vce(cluster country_id)
outreg2 using Table_1.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle("altinf") addstat("Years", e(g_max)) excel append
/* 10 */ qui xtreg F.v2x_frassoc_thick std_indust v2x_frassoc_thick i.year, fe vce(cluster country_id)
outreg2 using Table_1.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle("frassoc") addstat("Years", e(g_max)) excel append
/* 11 */ qui xtreg F.v2x_elecoff std_indust v2x_elecoff i.year, fe vce(cluster country_id)
outreg2 using Table_1.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle("elecoff") addstat("Years", e(g_max)) excel append
/* 12 */ qui xtreg F.v2x_suffr std_indust v2x_suffr i.year, fe vce(cluster country_id)
outreg2 using Table_1.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle("suffr") addstat("Years", e(g_max)) excel append
/* 13 */ qui xtreg F.e_polity2_scale std_indust e_polity2_scale i.year, fe vce(cluster country_id)
outreg2 using Table_1.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle("liberal") addstat("Years", e(g_max)) excel append
/* 14 */ qui xtreg F.e_uds_mean_scale std_indust e_uds_mean_scale i.year, fe vce(cluster country_id)
outreg2 using Table_1.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle("uds_mean") addstat("Years", e(g_max)) excel append
/* 15 */ qui xtreg F.e_fh_pr_scale std_indust e_fh_pr_scale i.year, fe vce(cluster country_id)
outreg2 using Table_1.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle("fh_pr") addstat("Years", e(g_max)) excel append
/* 16 */ qui xtreg F.e_fh_cl_scale std_indust e_fh_cl_scale i.year, fe vce(cluster country_id)
outreg2 using Table_1.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle("fh_cl") addstat("Years", e(g_max)) excel append
/* 17 */ qui xtreg F.e_mibmr std_indust e_mibmr i.year, fe vce(cluster country_id)
outreg2 using Table_1.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle("bmr") addstat("Years", e(g_max)) excel append
/* 18 */ qui xtreg F.e_lexical_index_scale std_indust e_lexical_index_scale i.year, fe vce(cluster country_id)
outreg2 using Table_1.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle("lexical") addstat("Years", e(g_max)) excel append
/* 19 */ qui xtreg F.v2x_contest std_indust v2x_contest i.year, fe vce(cluster country_id)
outreg2 using Table_1.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle("v2x_contest") addstat("Years", e(g_max)) excel append
/* 20 */ qui xtreg F.e_competition std_indust e_competition i.year, fe vce(cluster country_id)
outreg2 using Table_1.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle("competitive_elections") addstat("Years", e(g_max)) excel append
/* 21 */ qui xtreg F.v2xel_frefair std_indust v2xel_frefair i.year, fe vce(cluster country_id)
outreg2 using Table_1.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle("frefair") addstat("Years", e(g_max)) excel append


*=====================================
*	Table A6
*=====================================

use "Knutsen data merged.dta", clear
xtset country_id year
/* 1 */	qui xtreg F.e_competition std_indust e_competition i.year, fe vce(cluster country_id)
outreg2 using Table_2.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) addstat("Years", e(g_max), "Countries", e(N_g), "Observations", e(N), "R-squared", e(r2_w)) ctitle(" ") addn("Country clustered standard errors in brackets. *** p<0.01, ** p<0.05, * p<0.1") excel replace
/* 2 */ qui xtreg F.e_competition std_indust i.year, fe vce(cluster country_id)
outreg2 using Table_2.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle(" ") addstat("Years", e(g_max), "Countries", e(N_g), "Observations", e(N), "R-squared", e(r2_w)) excel append
/* 3 */ qui xtreg F.e_competition std_indust year, fe vce(cluster country_id)
outreg2 using Table_2.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle(" ") addstat("Years", e(g_max), "Countries", e(N_g), "Observations", e(N), "R-squared", e(r2_w)) excel append
/* 4 */ qui xtreg F.e_competition std_indust e_competition v2x_corr land_inequality e_competition_geo e_conflict_int_fill e_conflict_ext_fill e_resdep2 i.year, fe vce(cluster country_id)
outreg2 using Table_2.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle(" ") addstat("Years", e(g_max), "Countries", e(N_g), "Observations", e(N), "R-squared", e(r2_w)) excel append
/* 5 */ qui xtreg F.e_competition std_indust v2x_corr land_inequality e_competition_geo e_conflict_int_fill e_conflict_ext_fill e_resdep2 i.year, fe vce(cluster country_id)
outreg2 using Table_2.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle(" ") addstat("Years", e(g_max), "Countries", e(N_g), "Observations", e(N), "R-squared", e(r2_w)) excel append
/* 6 */ qui xtreg F.e_competition L20.std_indust i.year, fe vce(cluster country_id)
outreg2 using Table_2.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle(" ") addstat("Years", e(g_max), "Countries", e(N_g), "Observations", e(N), "R-squared", e(r2_w)) excel append
/* 7 */ preserve
drop if year != 2010 & year != 2005 & year != 2000 & year != 1995 & year != 1990 & year != 1985 & year != 1980 & year != 1975 & year != 1970 & year != 1965 & year != 1960 & year != 1955 & year != 1950 & year != 1945 & year != 1940 & year != 1935 & year != 1930 & year != 1925 & year != 1920 & year != 1915 & year != 1910 & year != 1905 & year != 1900 & year != 1895 & year != 1890 & year != 1885 & year != 1880 & year != 1875 & year != 1870 & year != 1865 & year != 1860 & year != 1855 & year != 1850 & year != 1845 & year != 1840 & year != 1835 & year != 1830 & year != 1825 & year != 1820 & year != 1815 & year != 1810 & year != 1805 & year != 1800
sort country_id year
by country_id: gen trend = _n
xtset country_id trend
qui xtreg F.e_competition std_indust e_competition i.year, fe vce(cluster country_id)
outreg2 using Table_2.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle(" ") addstat("Years", e(g_max), "Countries", e(N_g), "Observations", e(N), "R-squared", e(r2_w)) excel append
restore



*=====================================
*	Table A7
*=====================================

use "Knutsen data merged.dta", clear
xtset country_id year
/* 1 */ qui xtreg F.v2xel_frefair std_indust v2xel_frefair i.year, fe vce(cluster country_id)
outreg2 using Table_3.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle(" ") addstat("Years", e(g_max), "Countries", e(N_g), "Observations", e(N), "R-squared", e(r2_w)) addn("Country clustered standard errors in brackets. *** p<0.01, ** p<0.05, * p<0.1") excel replace
/* 2 */ qui xtreg F.v2xel_frefair std_indust i.year, fe vce(cluster country_id)
outreg2 using Table_3.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle(" ") addstat("Years", e(g_max), "Countries", e(N_g), "Observations", e(N), "R-squared", e(r2_w)) excel append
/* 3 */ qui xtreg F.v2xel_frefair std_indust year, fe vce(cluster country_id)
outreg2 using Table_3.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle(" ") addstat("Years", e(g_max), "Countries", e(N_g), "Observations", e(N), "R-squared", e(r2_w)) excel append
/* 4 */ qui xtreg F.v2xel_frefair std_indust v2xel_frefair v2x_corr land_inequality v2xel_frefair_geo e_conflict_int_fill e_conflict_ext_fill e_resdep2 i.year, fe vce(cluster country_id)
outreg2 using Table_3.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle(" ") addstat("Years", e(g_max), "Countries", e(N_g), "Observations", e(N), "R-squared", e(r2_w)) excel append
/* 5 */ qui xtreg F.v2xel_frefair std_indust v2x_corr land_inequality v2xel_frefair_geo e_conflict_int_fill e_conflict_ext_fill e_resdep2 i.year, fe vce(cluster country_id)
outreg2 using Table_3.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle(" ") addstat("Years", e(g_max), "Countries", e(N_g), "Observations", e(N), "R-squared", e(r2_w)) excel append
/* 6 */ qui xtreg F.v2xel_frefair L20.std_indust i.year, fe vce(cluster country_id)
outreg2 using Table_3.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle(" ") addstat("Years", e(g_max), "Countries", e(N_g), "Observations", e(N), "R-squared", e(r2_w)) excel append
/* 7 */ qui xtreg F.v2xel_frefair std_indust v2xel_frefair i.year if v2xel_frefair > 0, fe vce(cluster country_id)
outreg2 using Table_3.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle(" ") addstat("Years", e(g_max), "Countries", e(N_g), "Observations", e(N), "R-squared", e(r2_w)) excel append
/* 8 */ preserve
qui drop if year != 2010 & year != 2005 & year != 2000 & year != 1995 & year != 1990 & year != 1985 & year != 1980 & year != 1975 & year != 1970 & year != 1965 & year != 1960 & year != 1955 & year != 1950 & year != 1945 & year != 1940 & year != 1935 & year != 1930 & year != 1925 & year != 1920 & year != 1915 & year != 1910 & year != 1905 & year != 1900 & year != 1895 & year != 1890 & year != 1885 & year != 1880 & year != 1875 & year != 1870 & year != 1865 & year != 1860 & year != 1855 & year != 1850 & year != 1845 & year != 1840 & year != 1835 & year != 1830 & year != 1825 & year != 1820 & year != 1815 & year != 1810 & year != 1805 & year != 1800 
sort country_id year
by country_id: gen trend = _n
qui xtset country_id trend
qui xtreg F.v2xel_frefair std_indust v2xel_frefair i.year, fe vce(cluster country_id)
outreg2 using Table_3.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year) ctitle(" ") addstat("Years", e(g_max), "Countries", e(N_g), "Observations", e(N), "R-squared", e(r2_w)) excel append
restore
/* 9 */ preserve
qui drop if year != 2010 & year != 2005 & year != 2000 & year != 1995 & year != 1990 & year != 1985 & year != 1980 & year != 1975 & year != 1970 & year != 1965 & year != 1960 & year != 1955 & year != 1950 & year != 1945 & year != 1940 & year != 1935 & year != 1930 & year != 1925 & year != 1920 & year != 1915 & year != 1910 & year != 1905 & year != 1900 & year != 1895 & year != 1890 & year != 1885 & year != 1880 & year != 1875 & year != 1870 & year != 1865 & year != 1860 & year != 1855 & year != 1850 & year != 1845 & year != 1840 & year != 1835 & year != 1830 & year != 1825 & year != 1820 & year != 1815 & year != 1810 & year != 1805 & year != 1800
qui tostring year, gen(year_s)
qui encode year_s, gen(year_n)
qui xtset country_id year_n
qui xtabond2 F.v2xel_frefair v2xel_frefair std_indust i.year_n, gmm(std_indust v2xel_frefair, lag (2 3)) iv(i.year_n) robust
outreg2 using Table_3.xls, label se bdec(3) noni noobs nor nocon nonot drop(i.year_n) ctitle(" ") addstat("Years", e(g_max), "Countries", e(N_g), "Observations", e(N)) excel append
restore



*=====================================
*	Table A8
*=====================================

clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data" 
use "Industrialization and democracy final data (with variables recoded)"

/* Subsetting to 5 year intervals */
gen time = 0 if year==1845
replace time = 1 if year==1850
replace time = 2 if year==1855
replace time = 3 if year==1860
replace time = 4 if year==1865
replace time = 5 if year==1870
replace time = 6 if year==1875
replace time = 7 if year==1880
replace time = 8 if year==1885
replace time = 9 if year==1890
replace time = 10 if year==1895
replace time = 11 if year==1900
replace time = 12 if year==1905
replace time = 13 if year==1910
replace time = 14 if year==1915
replace time = 15 if year==1920
replace time = 16 if year==1925
replace time = 17 if year==1930
replace time = 18 if year==1935
replace time = 19 if year==1940
replace time = 20 if year==1945
replace time = 21 if year==1950
replace time = 22 if year==1955
replace time = 23 if year==1960
replace time = 24 if year==1965
replace time = 25 if year==1970
replace time = 26 if year==1975
replace time = 27 if year==1980
replace time = 28 if year==1985
replace time = 29 if year==1990
replace time = 30 if year==1995
replace time = 31 if year==2000
replace time = 32 if year==2005
replace time = 33 if year==2010
replace time = 34 if year==2015

tsset id time

keep if time!=.

egen std_indust = std(indust)
egen std_gini = std(gini)
egen std_years_edu = std(years_edu)
egen std_vdem_equality = std(v2xeg_eqdr)
egen std_ln_gdp = std(ln_gdp)
egen std_urbanization = std(urbanization)
egen std_oil_gdp = std(oil_gdp)
egen std_trade = std(trade)
egen std_breakdowns = std(e_democracy_breakdowns)
egen std_duration_regime = std(duration_regime)
egen std_state_ownership = std(state_ownership)
egen std_gdp_growth = std(gdp_growth)
egen std_pop_15_64 = std(pop_15_64)
gen ln_pop_15_65 = ln(pop_15_64)
egen std_ln_pop_15_65 = std(ln_pop_15_65)
egen std_political_cor = std(political_cor)
egen std_mva_gdp = std(mva_gdp)
egen std_min_empl = std(min_empl)
egen std_literacy = std(literacy)
gen ln_pop = ln(pop)
egen std_ln_pop = std(ln_pop)

gen l1_std_indust = l.std_indust

gen mature_deindust = 0 if indust!=.

replace mature_deindust = 1 if indust<l.indust &  industrialized==1 & year>1945

gen interaction = std_indust*mature_deindust

estimates clear

** Column 1 -- Bivariate
quietly: eststo sr_m1: xtreg vdem_elec l.vdem_elec l1_std_indust l.mature_deindust l.interaction i.time if sovereign2==1, fe robust
quietly: eststo lr_m1: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

** Column 2 -- GDP per capita and inequality
quietly: eststo sr_m2: xtreg vdem_elec l.vdem_elec l1_std_indust l.mature_deindust l.interaction l.std_vdem_equality l.std_ln_gdp l.std_years_edu l.std_urbanization i.time if sovereign2==1, fe robust
quietly: eststo delta_m2: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)
quietly: eststo lr_m2: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

** Column 3 -- Oil rents, and democracy in the region
quietly: eststo sr_m3: xtreg vdem_elec l.vdem_elec l1_std_indust l.mature_deindust l.interaction l1.std_oil_gdp l1.std_breakdowns l1.recession i.time if sovereign2==1, fe robust
quietly: eststo delta_m3: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)
quietly: eststo lr_m3: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

** Column 4 -- Trade and past reversals
quietly: eststo sr_m4: xtreg vdem_elec l.vdem_elec l1_std_indust l.mature_deindust l.interaction l1.std_duration_regime l1.property_rights l1.std_trade i.time if sovereign2==1, fe robust
quietly: eststo delta_m4: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)
quietly: eststo lr_m4: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

** Column 5 -- Western alignment and warfare
quietly: eststo sr_m5: xtreg vdem_elec l.vdem_elec l1_std_indust l.mature_deindust l.interaction l1.democracy_after_autconst l1.std_state_ownership l1.std_political_cor i.time if sovereign2==1, fe robust
quietly: eststo delta_m5: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)
quietly: eststo lr_m5: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

** Column 6 -- Duration regime, GDP growth, and state ownership
quietly: eststo sr_m6: xtreg vdem_elec l.vdem_elec l1_std_indust l.mature_deindust l.interaction l1.western_align l1.inter_war l1.intra_war i.time if sovereign2==1, fe robust
quietly: eststo delta_m6: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)
quietly: eststo lr_m6: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

estout sr_m1 sr_m2 sr_m3 sr_m4 sr_m5 sr_m6, cells(b(star fmt(3)) se(par fmt(3))) legend stats(oster_delta N N_g, fmt(%7.1f %7.0f %7.0f)) starlevels(* 0.05 ** 0.01 *** 0.001) drop(*time*) 
estout delta_m2 delta_m3 delta_m4 delta_m5 delta_m6, legend label stats(delta, fmt(%7.1f)) keep(*_cons*)
estout lr_m1 lr_m2 lr_m3 lr_m4 lr_m5 lr_m6, cells(b(star fmt(3)) se(par fmt(3))) starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) legend label 


*=====================================
*	Table A9
*=====================================

clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

/*
Islands that are not on Scotese's map are not coded
*/

gen entirely_tropical = 0
replace entirely_tropical = 1 if country_name=="Mexico"
replace entirely_tropical = 1 if country_name=="Guatemala"
replace entirely_tropical = 1 if country_name=="Honduras"
replace entirely_tropical = 1 if country_name=="Nicaragua"
replace entirely_tropical = 1 if country_name=="El Salvador"
replace entirely_tropical = 1 if country_name=="Costa Rica"
replace entirely_tropical = 1 if country_name=="Panama"
replace entirely_tropical = 1 if country_name=="Western Sahara" // = missing (disputed territory)
replace entirely_tropical = 1 if country_name=="Morocco"
replace entirely_tropical = 1 if country_name=="United Kingdom"
replace entirely_tropical = 1 if country_name=="Ireland"
replace entirely_tropical = 1 if country_name=="Estonia"
replace entirely_tropical = 1 if country_name=="Latvia"
replace entirely_tropical = 1 if country_name=="Poland"
replace entirely_tropical = 1 if country_name=="Denmark"
replace entirely_tropical = 1 if country_name=="Germany"
replace entirely_tropical = 1 if country_name=="West Germany"
replace entirely_tropical = 1 if country_name=="Netherlands"
replace entirely_tropical = 1 if country_name=="Belgium"
replace entirely_tropical = 1 if country_name=="Luxembourg"
replace entirely_tropical = 1 if country_name=="France"
replace entirely_tropical = 1 if country_name=="Portugal"
replace entirely_tropical = 1 if country_name=="Spain"
replace entirely_tropical = 1 if country_name=="Italy"
replace entirely_tropical = 1 if country_name=="Greece"
replace entirely_tropical = 1 if country_name=="Albania"
replace entirely_tropical = 1 if country_name=="Turkey"
replace entirely_tropical = 1 if country_name=="Jordan"
replace entirely_tropical = 1 if country_name=="Israel"
replace entirely_tropical = 1 if country_name=="Lebanon"
replace entirely_tropical = 1 if country_name=="Syria"
replace entirely_tropical = 1 if country_name=="Switzerland"
replace entirely_tropical = 1 if country_name=="Austria" // assumed to be connected to Western Europe
replace entirely_tropical = 1 if country_name=="Bulgaria" // assumed to be connected to Western Europe
replace entirely_tropical = 1 if country_name=="Hungary" // assumed to be connected to Western Europe
replace entirely_tropical = 1 if country_name=="Romania" // assumed to be connected to Western Europe
replace entirely_tropical = 1 if country_name=="South Korea" // assumed to be connected to North China

gen half_tropical = 0
replace half_tropical = 1 if country_name=="United States"
replace half_tropical = 1 if country_name=="Norway"
replace half_tropical = 1 if country_name=="Sweden"
replace half_tropical = 1 if country_name=="China"

gen somewhat_tropical = 0 
replace somewhat_tropical = 1 if country_name=="Ecuador"
replace somewhat_tropical = 1 if country_name=="Colombia"
replace somewhat_tropical = 1 if country_name=="Venezuela"
replace somewhat_tropical = 1 if country_name=="Mauritania"
replace somewhat_tropical = 1 if country_name=="Algeria"
replace somewhat_tropical = 1 if country_name=="Canada"
replace somewhat_tropical = 1 if country_name=="Greenland" // = missing
replace somewhat_tropical = 1 if country_name=="Finland"
replace somewhat_tropical = 1 if country_name=="Russia"
replace somewhat_tropical = 1 if country_name=="Egypt"
replace somewhat_tropical = 1 if country_name=="Libya"
replace somewhat_tropical = 1 if country_name=="Iraq"

gen non_tropical = 0 
replace non_tropical = 1 if country_name=="India"
replace non_tropical = 1 if country_name=="Australia"
replace non_tropical = 1 if country_name=="New Zealand"
replace non_tropical = 1 if country_name=="Venezuela"
replace non_tropical = 1 if country_name=="Guyana"
replace non_tropical = 1 if country_name=="Suriname"
replace non_tropical = 1 if country_name=="French Guiana" // Part of Guinea
replace non_tropical = 1 if country_name=="Brazil"
replace non_tropical = 1 if country_name=="Peru"
replace non_tropical = 1 if country_name=="Bolivia"
replace non_tropical = 1 if country_name=="Paraguay"
replace non_tropical = 1 if country_name=="Chile"
replace non_tropical = 1 if country_name=="Argentina"
replace non_tropical = 1 if country_name=="Uruguay"
replace non_tropical = 1 if country_name=="Tunisia"
replace non_tropical = 1 if country_name=="Mali"
replace non_tropical = 1 if country_name=="Niger"
replace non_tropical = 1 if country_name=="Chad"
replace non_tropical = 1 if country_name=="Sudan"
replace non_tropical = 1 if country_name=="Eritrea"
replace non_tropical = 1 if country_name=="Djibouti"
replace non_tropical = 1 if country_name=="Senegal"
replace non_tropical = 1 if country_name=="The Gambia"
replace non_tropical = 1 if country_name=="Guinea-Bissau"
replace non_tropical = 1 if country_name=="Guinea"
replace non_tropical = 1 if country_name=="Sierra Leone"
replace non_tropical = 1 if country_name=="Liberia"
replace non_tropical = 1 if country_name=="Ivory Coast"
replace non_tropical = 1 if country_name=="Burkina Faso"
replace non_tropical = 1 if country_name=="Ghana"
replace non_tropical = 1 if country_name=="Togo"
replace non_tropical = 1 if country_name=="Benin"
replace non_tropical = 1 if country_name=="Nigeria"
replace non_tropical = 1 if country_name=="Cameroon"
replace non_tropical = 1 if country_name=="Central African Republic"
replace non_tropical = 1 if country_name=="South Sudan"
replace non_tropical = 1 if country_name=="Ethiopia"
replace non_tropical = 1 if country_name=="Somalia"
replace non_tropical = 1 if country_name=="Equatorial Guinea" 
replace non_tropical = 1 if country_name=="Gabon"
replace non_tropical = 1 if country_name=="Republic of the Congo"
replace non_tropical = 1 if country_name=="Democratic Republic of Congo"
replace non_tropical = 1 if country_name=="Uganda"
replace non_tropical = 1 if country_name=="Rwanda"
replace non_tropical = 1 if country_name=="Burundi"
replace non_tropical = 1 if country_name=="Kenya"
replace non_tropical = 1 if country_name=="Tanzania"
replace non_tropical = 1 if country_name=="Angola"
replace non_tropical = 1 if country_name=="Zambia"
replace non_tropical = 1 if country_name=="Malawi"
replace non_tropical = 1 if country_name=="Mozambique"
replace non_tropical = 1 if country_name=="Namibia"
replace non_tropical = 1 if country_name=="Botswana"
replace non_tropical = 1 if country_name=="Zimbabwe"
replace non_tropical = 1 if country_name=="South Africa"
replace non_tropical = 1 if country_name=="Swaziland"
replace non_tropical = 1 if country_name=="Lesotho"
replace non_tropical = 1 if country_name=="Iran"
replace non_tropical = 1 if country_name=="Bangladesh" // assumed to be connected to the Indian subcontinent
replace non_tropical = 1 if country_name=="Nepal" // assumed to be connected to the Indian subcontinent
replace non_tropical = 1 if country_name=="Pakistan" // assumed to be connected to the Indian subcontinent
replace non_tropical = 1 if country_name=="Sri Lanka" // assumed to be connected to the Indian subcontinent
replace non_tropical = 1 if country_name=="Hong Kong" // assumed to be connected to South China
replace non_tropical = 1 if country_name=="Thailand" // assumed to be connected to South China or the Indian subcontinent
replace non_tropical = 1 if country_name=="Singapore" // assumed to be connected to South China or the Indian subcontinent
replace non_tropical = 1 if country_name=="Malaysia" // assumed to be connected to South China or the Indian subcontinent

gen tropical = .
replace tropical = 0 if non_tropical==1 
replace tropical = 0 if somewhat_tropical==1 
replace tropical = 1 if half_tropical==1 
replace tropical = 1 if entirely_tropical==1 

gen tropical2 = .
replace tropical2 = 0 if non_tropical==1 
replace tropical2 = 1 if somewhat_tropical==1 
replace tropical2 = 1 if half_tropical==1 
replace tropical2 = 1 if entirely_tropical==1 

gen tropical3 = .
replace tropical3 = 0 if non_tropical==1 
replace tropical3 = 0 if somewhat_tropical==1 
replace tropical3 = 0 if half_tropical==1 
replace tropical3 = 1 if entirely_tropical==1 
 
 
 bysort country_name: gen tropical_2015 = nunn_tropical if year == 2015
bysort country_name: egen tropical_today = max(tropical_2015)

bysort country_name: gen soil_2015 = soilsui1 + soilsui2 if year == 2015
bysort country_name: egen soil = max(soil_2015)

bys id: egen avg_oil_gas_gdp_60_70 = mean(oil_gas_gdp) if inrange(year,1960,1970)
bys id: egen avg_oil_gas_gdp_70_80 = mean(oil_gas_gdp) if inrange(year,1970,1980)
bys id: egen avg_oil_gas_gdp_80_90 = mean(oil_gas_gdp) if inrange(year,1980,1990)
bys id: egen avg_oil_gas_gdp_90_00 = mean(oil_gas_gdp) if inrange(year,1990,2000)
bys id: egen avg_oil_gas_gdp_00_10 = mean(oil_gas_gdp) if inrange(year,2000,2010)

bys country_name: egen avg_conflict = mean(conflict*100) if year<1971
bys country_name: egen avg_conflict_1990 = mean(conflict*100) if year<1991
bys country_name: egen avg_conflict_2000 = mean(conflict*100) if year<2001
bys country_name: egen avg_conflict_2010 = mean(conflict*100) if year<2011

estimates clear 
 
* Column 1 -- Bivariate
quietly: ivreg2 vdem_elec  (indust = tropical) i.year if sovereign2==1, first cluster(id) savefirst savefprefix(first1)
 mat list e(first)
quietly: weakivtest 
estadd scalar F_eff = r(F_eff)
quietly: estimates store m1, title(2SLS)

quietly: reg vdem_elec  indust i.year if sovereign2==1 & tropical!=., vce(cluster id)
quietly: estimates store m1a, title(OLS)

* Columnn 2 -- Tropical climate today
quietly: ivreg2 vdem_elec  tropical_today (indust = tropical) i.year if sovereign2==1, first cluster(id) savefirst savefprefix(first2)
 mat list e(first)
quietly: weakivtest 
estadd scalar F_eff = r(F_eff)
quietly: estimates store m2, title(2SLS)

quietly: reg vdem_elec  indust tropical_today i.year if sovereign2==1 & tropical!=., vce(cluster id)
quietly: estimates store m2a, title(OLS)

** Column 3 -- Soil quality today
quietly: ivreg2 vdem_elec  soil (indust = tropical) i.year if sovereign2==1, first cluster(id) savefirst savefprefix(first3)
 mat list e(first)
quietly: weakivtest 
estadd scalar F_eff = r(F_eff)
quietly: estimates store m3, title(2SLS)

quietly: reg vdem_elec  indust soil i.year if sovereign2==1 & tropical!=., vce(cluster id)
quietly: estimates store m3a, title(OLS)

** Column 4 -- Natural resource rents ex coal (% of GDP)
quietly: ivreg2 vdem_elec  rents_excl_coal (indust = tropical) i.year if sovereign2==1, first cluster(id) savefirst savefprefix(first4)
 mat list e(first)
quietly: weakivtest 
estadd scalar F_eff = r(F_eff)
quietly: estimates store m4, title(2SLS)

quietly: reg vdem_elec  rents_excl_coal indust  i.year if sovereign2==1 & tropical!=., vce(cluster id)
quietly: estimates store m4a, title(OLS)

** Column 5 -- Polity in 1800
quietly: ivreg2 vdem_elec  ipolated_polity_value1800 (indust = tropical) i.year if sovereign2==1, first cluster(id) savefirst savefprefix(first5)
 mat list e(first)
quietly: weakivtest 
estadd scalar F_eff = r(F_eff)
quietly: estimates store m5, title(2SLS)

quietly: reg vdem_elec  indust ipolated_polity_value1800 i.year if sovereign2==1 & tropical!=., vce(cluster id)
quietly: estimates store m5a, title(OLS)

** Column 6 -- Employment in mining
quietly: ivreg2 vdem_elec  min_emp (indust = tropical) i.year if sovereign2==1, first cluster(id) savefirst savefprefix(first7)
 mat list e(first)
quietly: weakivtest 
estadd scalar F_eff = r(F_eff)
quietly: estimates store m6, title(2SLS)

quietly: reg vdem_elec  indust min_emp i.year if sovereign2==1 & tropical!=., vce(cluster id)
quietly: estimates store m6a, title(OLS) 

** Column 7 -- Conflict
quietly: ivreg2 vdem_elec  conflict (indust = tropical) i.year if sovereign2==1, first cluster(id) savefirst savefprefix(first6)
 mat list e(first)
quietly: weakivtest 
estadd scalar F_eff = r(F_eff)
quietly: estimates store m7, title(2SLS)

quietly: reg vdem_elec  indust conflict i.year if sovereign2==1 & tropical!=., vce(cluster id)
quietly: estimates store m7a, title(OLS)
 
 
estout m1 m2 m3 m4 m5 m6 m7, cells(b(star fmt(3)) se(par fmt(3))) starlevels(* 0.10 ** 0.05 *** 0.01) legend label stats(N_g N F_eff, fmt(%7.0f %7.0f %7.1f)) keep(indust)

estout m1a m2a m3a m4a m5a m6a m7a, cells(b(star fmt(3)) se(par fmt(3))) starlevels(* 0.10 ** 0.05 *** 0.01) legend label stats(r2_a N_g N, fmt(%7.3f %7.0f %7.0f)) keep(indust)


********************************************************************
**************************** Figure A 3 **************************** 
********************************************************************

clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

/*
Islands that are not on Scotese's map are not coded
*/

gen entirely_tropical = 0
replace entirely_tropical = 1 if country_name=="Mexico"
replace entirely_tropical = 1 if country_name=="Guatemala"
replace entirely_tropical = 1 if country_name=="Honduras"
replace entirely_tropical = 1 if country_name=="Nicaragua"
replace entirely_tropical = 1 if country_name=="El Salvador"
replace entirely_tropical = 1 if country_name=="Costa Rica"
replace entirely_tropical = 1 if country_name=="Panama"
replace entirely_tropical = 1 if country_name=="Western Sahara" // = missing (disputed territory)
replace entirely_tropical = 1 if country_name=="Morocco"
replace entirely_tropical = 1 if country_name=="United Kingdom"
replace entirely_tropical = 1 if country_name=="Ireland"
replace entirely_tropical = 1 if country_name=="Estonia"
replace entirely_tropical = 1 if country_name=="Latvia"
replace entirely_tropical = 1 if country_name=="Poland"
replace entirely_tropical = 1 if country_name=="Denmark"
replace entirely_tropical = 1 if country_name=="Germany"
replace entirely_tropical = 1 if country_name=="West Germany"
replace entirely_tropical = 1 if country_name=="Netherlands"
replace entirely_tropical = 1 if country_name=="Belgium"
replace entirely_tropical = 1 if country_name=="Luxembourg"
replace entirely_tropical = 1 if country_name=="France"
replace entirely_tropical = 1 if country_name=="Portugal"
replace entirely_tropical = 1 if country_name=="Spain"
replace entirely_tropical = 1 if country_name=="Italy"
replace entirely_tropical = 1 if country_name=="Greece"
replace entirely_tropical = 1 if country_name=="Albania"
replace entirely_tropical = 1 if country_name=="Turkey"
replace entirely_tropical = 1 if country_name=="Jordan"
replace entirely_tropical = 1 if country_name=="Israel"
replace entirely_tropical = 1 if country_name=="Lebanon"
replace entirely_tropical = 1 if country_name=="Syria"
replace entirely_tropical = 1 if country_name=="Switzerland"
replace entirely_tropical = 1 if country_name=="Austria" // assumed to be connected to Western Europe
replace entirely_tropical = 1 if country_name=="Bulgaria" // assumed to be connected to Western Europe
replace entirely_tropical = 1 if country_name=="Hungary" // assumed to be connected to Western Europe
replace entirely_tropical = 1 if country_name=="Romania" // assumed to be connected to Western Europe
replace entirely_tropical = 1 if country_name=="South Korea" // assumed to be connected to North China

gen half_tropical = 0
replace half_tropical = 1 if country_name=="United States"
replace half_tropical = 1 if country_name=="Norway"
replace half_tropical = 1 if country_name=="Sweden"
replace half_tropical = 1 if country_name=="China"

gen somewhat_tropical = 0 
replace somewhat_tropical = 1 if country_name=="Ecuador"
replace somewhat_tropical = 1 if country_name=="Colombia"
replace somewhat_tropical = 1 if country_name=="Venezuela"
replace somewhat_tropical = 1 if country_name=="Mauritania"
replace somewhat_tropical = 1 if country_name=="Algeria"
replace somewhat_tropical = 1 if country_name=="Canada"
replace somewhat_tropical = 1 if country_name=="Greenland" // = missing
replace somewhat_tropical = 1 if country_name=="Finland"
replace somewhat_tropical = 1 if country_name=="Russia"
replace somewhat_tropical = 1 if country_name=="Egypt"
replace somewhat_tropical = 1 if country_name=="Libya"
replace somewhat_tropical = 1 if country_name=="Iraq"

gen non_tropical = 0 
replace non_tropical = 1 if country_name=="India"
replace non_tropical = 1 if country_name=="Australia"
replace non_tropical = 1 if country_name=="New Zealand"
replace non_tropical = 1 if country_name=="Venezuela"
replace non_tropical = 1 if country_name=="Guyana"
replace non_tropical = 1 if country_name=="Suriname"
replace non_tropical = 1 if country_name=="French Guiana" // Part of Guinea
replace non_tropical = 1 if country_name=="Brazil"
replace non_tropical = 1 if country_name=="Peru"
replace non_tropical = 1 if country_name=="Bolivia"
replace non_tropical = 1 if country_name=="Paraguay"
replace non_tropical = 1 if country_name=="Chile"
replace non_tropical = 1 if country_name=="Argentina"
replace non_tropical = 1 if country_name=="Uruguay"
replace non_tropical = 1 if country_name=="Tunisia"
replace non_tropical = 1 if country_name=="Mali"
replace non_tropical = 1 if country_name=="Niger"
replace non_tropical = 1 if country_name=="Chad"
replace non_tropical = 1 if country_name=="Sudan"
replace non_tropical = 1 if country_name=="Eritrea"
replace non_tropical = 1 if country_name=="Djibouti"
replace non_tropical = 1 if country_name=="Senegal"
replace non_tropical = 1 if country_name=="The Gambia"
replace non_tropical = 1 if country_name=="Guinea-Bissau"
replace non_tropical = 1 if country_name=="Guinea"
replace non_tropical = 1 if country_name=="Sierra Leone"
replace non_tropical = 1 if country_name=="Liberia"
replace non_tropical = 1 if country_name=="Ivory Coast"
replace non_tropical = 1 if country_name=="Burkina Faso"
replace non_tropical = 1 if country_name=="Ghana"
replace non_tropical = 1 if country_name=="Togo"
replace non_tropical = 1 if country_name=="Benin"
replace non_tropical = 1 if country_name=="Nigeria"
replace non_tropical = 1 if country_name=="Cameroon"
replace non_tropical = 1 if country_name=="Central African Republic"
replace non_tropical = 1 if country_name=="South Sudan"
replace non_tropical = 1 if country_name=="Ethiopia"
replace non_tropical = 1 if country_name=="Somalia"
replace non_tropical = 1 if country_name=="Equatorial Guinea" 
replace non_tropical = 1 if country_name=="Gabon"
replace non_tropical = 1 if country_name=="Republic of the Congo"
replace non_tropical = 1 if country_name=="Democratic Republic of Congo"
replace non_tropical = 1 if country_name=="Uganda"
replace non_tropical = 1 if country_name=="Rwanda"
replace non_tropical = 1 if country_name=="Burundi"
replace non_tropical = 1 if country_name=="Kenya"
replace non_tropical = 1 if country_name=="Tanzania"
replace non_tropical = 1 if country_name=="Angola"
replace non_tropical = 1 if country_name=="Zambia"
replace non_tropical = 1 if country_name=="Malawi"
replace non_tropical = 1 if country_name=="Mozambique"
replace non_tropical = 1 if country_name=="Namibia"
replace non_tropical = 1 if country_name=="Botswana"
replace non_tropical = 1 if country_name=="Zimbabwe"
replace non_tropical = 1 if country_name=="South Africa"
replace non_tropical = 1 if country_name=="Swaziland"
replace non_tropical = 1 if country_name=="Lesotho"
replace non_tropical = 1 if country_name=="Iran"
replace non_tropical = 1 if country_name=="Bangladesh" // assumed to be connected to the Indian subcontinent
replace non_tropical = 1 if country_name=="Nepal" // assumed to be connected to the Indian subcontinent
replace non_tropical = 1 if country_name=="Pakistan" // assumed to be connected to the Indian subcontinent
replace non_tropical = 1 if country_name=="Sri Lanka" // assumed to be connected to the Indian subcontinent
replace non_tropical = 1 if country_name=="Hong Kong" // assumed to be connected to South China
replace non_tropical = 1 if country_name=="Thailand" // assumed to be connected to South China or the Indian subcontinent
replace non_tropical = 1 if country_name=="Singapore" // assumed to be connected to South China or the Indian subcontinent
replace non_tropical = 1 if country_name=="Malaysia" // assumed to be connected to South China or the Indian subcontinent

gen tropical = .
replace tropical = 0 if non_tropical==1 
replace tropical = 0 if somewhat_tropical==1 
replace tropical = 1 if half_tropical==1 
replace tropical = 1 if entirely_tropical==1 

gen tropical2 = .
replace tropical2 = 0 if non_tropical==1 
replace tropical2 = 1 if somewhat_tropical==1 
replace tropical2 = 1 if half_tropical==1 
replace tropical2 = 1 if entirely_tropical==1 

gen tropical3 = .
replace tropical3 = 0 if non_tropical==1 
replace tropical3 = 0 if somewhat_tropical==1 
replace tropical3 = 0 if half_tropical==1 
replace tropical3 = 1 if entirely_tropical==1 
 

** Reduced form effect
regress vdem_elec tropical i.year if sovereign2==1, first cluster(id) 
// 2.01073  (.4607521 )

quietly plausexog uci vdem_elec (indust = tropical) i.year if sovereign2==1, vce(cluster id) level(.95) gmin(0) gmax(2) graph(indust) scheme(sj) ytitle(Estimated {&beta}) xtitle({&delta}) legend(order(1 "95% confidence interval"))


*=====================================
*	Figure A4
*=====================================

clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

/* Subsetting to 5 year intervals */
gen time = 0 if year==1845
replace time = 1 if year==1850
replace time = 2 if year==1855
replace time = 3 if year==1860
replace time = 4 if year==1865
replace time = 5 if year==1870
replace time = 6 if year==1875
replace time = 7 if year==1880
replace time = 8 if year==1885
replace time = 9 if year==1890
replace time = 10 if year==1895
replace time = 11 if year==1900
replace time = 12 if year==1905
replace time = 13 if year==1910
replace time = 14 if year==1915
replace time = 15 if year==1920
replace time = 16 if year==1925
replace time = 17 if year==1930
replace time = 18 if year==1935
replace time = 19 if year==1940
replace time = 20 if year==1945
replace time = 21 if year==1950
replace time = 22 if year==1955
replace time = 23 if year==1960
replace time = 24 if year==1965
replace time = 25 if year==1970
replace time = 26 if year==1975
replace time = 27 if year==1980
replace time = 28 if year==1985
replace time = 29 if year==1990
replace time = 30 if year==1995
replace time = 31 if year==2000
replace time = 32 if year==2005
replace time = 33 if year==2010
replace time = 34 if year==2015

keep if time!=.

tsset id time

estimates clear

egen std_indust = std(indust)


** Excluding Scandinavia
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1 & scandinavia==0, fe robust
quietly: eststo excl_scandinavia: nlcom (excl_scandinavia: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding North-West Europe
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1 & north_west_europe==0, fe robust
quietly: eststo excl_north_west_europe: nlcom (excl_north_west_europe: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding Southern Europe
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1 & southern_europe==0, fe robust
quietly: eststo excl_southern_europe: nlcom (excl_southern_europe: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding UK and british offshoots
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1 & british_offshoots==0, fe robust
quietly: eststo excl_british_offshoots: nlcom (excl_british_offshoots: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding Eastern Europe
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1 & eastern_europe==0, fe robust
quietly: eststo excl_eastern_europe: nlcom (excl_eastern_europe: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding Balkan
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1 & balkans==0, fe robust
quietly: eststo excl_balkan: nlcom (excl_balkan: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding ex-USSR
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1 & ex_ussr==0, fe robust
quietly: eststo excl_ex_ussr: nlcom (excl_ex_ussr: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding South America
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1 & south_america==0, fe robust
quietly: eststo excl_south_america: nlcom (excl_south_america: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding Central America
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1 & central_america==0, fe robust
quietly: eststo excl_central_america: nlcom (excl_central_america: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding North Africa
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1 & north_africa==0, fe robust
quietly: eststo excl_north_africa: nlcom (excl_north_africa: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding Middle East
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1 & middle_east==0, fe robust
quietly: eststo excl_middle_east: nlcom (excl_middle_east: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding SSA
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1 & e_region_world_2!=4, fe robust
quietly: eststo excl_ssa: nlcom (excl_ssa: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding East Asia
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1 & e_region_world_2!=6, fe robust
quietly: eststo excl_east_asia: nlcom (excl_east_asia: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding Southeast Asia
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1 & e_region_world_2!=7, fe robust
quietly: eststo excl_southeast_asia: nlcom (excl_southeast_asia: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding South Asia
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1 & e_region_world_2!=8, fe robust
quietly: eststo excl_south_asia: nlcom (excl_south_asia: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding Pacific
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1 & e_region_world_2!=9, fe robust
quietly: eststo excl_pacific: nlcom (excl_pacific: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Excluding Carribean
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1 & e_region_world_2!=9, fe robust
quietly: eststo excl_carribean: nlcom (excl_carribean: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Balanced sample (1960-2000)
clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

tsset id year
gen l1_vdem_elec = l.vdem_elec
gen l1_indust = l.indust
xtbalance , range(1960 2000) miss(vdem_elec l1_vdem_elec l1_indust)

gen time = 0 if year==1845
replace time = 1 if year==1960
replace time = 2 if year==1965
replace time = 3 if year==1970
replace time = 4 if year==1975
replace time = 5 if year==1980
replace time = 6 if year==1985
replace time = 7 if year==1990
replace time = 8 if year==1995
replace time = 9 if year==2000

keep if time!=.

tsset id time

egen std_indust = std(indust)


quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1, fe robust
quietly: eststo balanced_1960_2000: nlcom (balanced_1960_2000: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Post-1945

clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

/* Subsetting to 5 year intervals */
gen time = 0 if year==1845
replace time = 1 if year==1850
replace time = 2 if year==1855
replace time = 3 if year==1860
replace time = 4 if year==1865
replace time = 5 if year==1870
replace time = 6 if year==1875
replace time = 7 if year==1880
replace time = 8 if year==1885
replace time = 9 if year==1890
replace time = 10 if year==1895
replace time = 11 if year==1900
replace time = 12 if year==1905
replace time = 13 if year==1910
replace time = 14 if year==1915
replace time = 15 if year==1920
replace time = 16 if year==1925
replace time = 17 if year==1930
replace time = 18 if year==1935
replace time = 19 if year==1940
replace time = 20 if year==1945
replace time = 21 if year==1950
replace time = 22 if year==1955
replace time = 23 if year==1960
replace time = 24 if year==1965
replace time = 25 if year==1970
replace time = 26 if year==1975
replace time = 27 if year==1980
replace time = 28 if year==1985
replace time = 29 if year==1990
replace time = 30 if year==1995
replace time = 31 if year==2000
replace time = 32 if year==2005
replace time = 33 if year==2010
replace time = 34 if year==2015

keep if time!=.

tsset id time

egen std_indust = std(indust)


quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1 & year>=1945, fe robust
quietly: eststo post_1945: nlcom (post_1945: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Post-1975
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1 & year>=1975, fe robust
quietly: eststo post_1975: nlcom (post_1975: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Post-1990
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1 & year>=1989, fe robust
quietly: eststo post_1990: nlcom (post_1990: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Pooled OLS
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1, re robust
quietly: eststo pooled: nlcom (pooled: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** No time FE
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization if sovereign2==1, fe robust
quietly: eststo no_time_fe: nlcom (no_time_fe: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** No lagged DV
quietly: eststo: xtreg vdem_elec l.std_indust l.urbanization i.time if sovereign2==1, fe robust
quietly: eststo no_lag: nlcom (no_lag: _b[l.std_indust]), post

** Global linear time trends
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization time i.time if sovereign2==1, fe robust
quietly: eststo global_trend: nlcom (global_trend: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Continent linear time trends
quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization c.time##i.continents i.time if sovereign2==1, fe robust
quietly: eststo continent_trend: nlcom (continent_trend: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Country specific linear time trends
quietly: eststo: reg vdem_elec l.vdem_elec l.std_indust l.urbanization c.time##i.id if sovereign2==1, vce(cluster id)
quietly: eststo country_trend: nlcom (country_trend: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Country specific quadratic time trends
gen time2 = time*time

quietly: eststo: reg vdem_elec l.vdem_elec l.std_indust l.urbanization time c.time2##i.id if sovereign2==1, vce(cluster id)
quietly: eststo quadratic_trend: nlcom (quadratic_trend: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** PCSE ols
quietly: eststo: xtpcse vdem_elec l.vdem_elec l.std_indust l.urbanization i.time i.id if sovereign2==1, pairwise hetonly correlation(psar1)
quietly: eststo pcse: nlcom (pcse: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Difference-GMM
tab time, gen (yr)

quietly: eststo: xtabond2 vdem_elec L.(vdem_elec std_indust) yr* if sovereign2==1, gmm(L.(vdem_elec)) iv(yr*) iv(L2.std_indust) noleveleq robust 
quietly: eststo diff_gmm: nlcom (diff_gmm: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** System-GMM
quietly: eststo: xtabond2 vdem_elec L.(vdem_elec std_indust) yr* if sovereign2==1, gmm(L.(vdem_elec), collapse) iv(yr*) iv(L2.std_indust) robust 
quietly: eststo system_gmm: nlcom (system_gmm: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** V-dem liberal democracy index
quietly: eststo: xtreg vdem_lib l.vdem_lib l.std_indust l.urbanization i.time if sovereign2==1, fe robust
quietly: eststo vdem_lib: nlcom (vdem_lib: _b[l.std_indust]/(1-_b[l.vdem_lib])), post

** Universal suffrage
quietly: eststo: xtreg universal_suffrage l.universal_suffrage l.std_indust l.urbanization i.time if sovereign2==1, fe robust
quietly: eststo universal_suffrage: nlcom (universal_suffrage: _b[l.std_indust]/(1-_b[l.universal_suffrage])), post

** Universal male suffrage
quietly: eststo: xtreg male_suffrage l.male_suffrage l.std_indust l.urbanization i.time if sovereign2==1, fe robust
quietly: eststo male_suffrage: nlcom (male_suffrage: _b[l.std_indust]/(1-_b[l.male_suffrage])), post

** Universal female suffrage
quietly: eststo: xtreg female_suffrage l.female_suffrage l.male_suffrage l.std_indust l.urbanization i.time if sovereign2==1, fe robust
quietly: eststo female_suffrage: nlcom (female_suffrage: _b[l.std_indust]/(1-_b[l.female_suffrage])), post

** Judicial constraints on exective index
quietly: eststo: xtreg judicial_constraints l.judicial_constraints l.std_indust l.urbanization i.time if sovereign2==1, fe robust
quietly: eststo judicial_constraints: nlcom (judicial_constraints: _b[l.std_indust]/(1-_b[l.judicial_constraints])), post

** Combined Polity IV
quietly: eststo: xtreg polity l.polity l.std_indust l.urbanization i.time if sovereign2==1, fe robust
quietly: eststo polity: nlcom (polity: _b[l.std_indust]/(1-_b[l.polity])), post

** Lexical index
quietly: eststo: xtreg lexical l.lexical l.std_indust l.urbanization i.time if sovereign2==1, fe robust
quietly: eststo lexical: nlcom (lexical: _b[l.std_indust]/(1-_b[l.lexical])), post

** Boix et. al. (2013)
quietly: eststo: xtreg boix l.boix l.std_indust l.urbanization i.time if sovereign2==1, fe robust
quietly: eststo boix: nlcom (boix: _b[l.std_indust]/(1-_b[l.boix])), post

** Cheibub et. al. (2010)
quietly: eststo: xtreg cheibub l.cheibub l.std_indust l.urbanization i.time if sovereign2==1, fe robust
quietly: eststo cheibub: nlcom (cheibub: _b[l.std_indust]/(1-_b[l.cheibub])), post

** 1 year, regular intervals
clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

tsset id year

egen std_indust = std(indust)

quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.year if sovereign2==1, fe robust
quietly: eststo intervals_1yr: nlcom (intervals_1yr: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** 5 year, regular intervals

clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

/* Subsetting to 5 year intervals */
gen time = 0 if year==1845
replace time = 1 if year==1850
replace time = 2 if year==1855
replace time = 3 if year==1860
replace time = 4 if year==1865
replace time = 5 if year==1870
replace time = 6 if year==1875
replace time = 7 if year==1880
replace time = 8 if year==1885
replace time = 9 if year==1890
replace time = 10 if year==1895
replace time = 11 if year==1900
replace time = 12 if year==1905
replace time = 13 if year==1910
replace time = 14 if year==1915
replace time = 15 if year==1920
replace time = 16 if year==1925
replace time = 17 if year==1930
replace time = 18 if year==1935
replace time = 19 if year==1940
replace time = 20 if year==1945
replace time = 21 if year==1950
replace time = 22 if year==1955
replace time = 23 if year==1960
replace time = 24 if year==1965
replace time = 25 if year==1970
replace time = 26 if year==1975
replace time = 27 if year==1980
replace time = 28 if year==1985
replace time = 29 if year==1990
replace time = 30 if year==1995
replace time = 31 if year==2000
replace time = 32 if year==2005
replace time = 33 if year==2010
replace time = 34 if year==2015

keep if time!=.

tsset id time

egen std_indust = std(indust)

quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1, fe robust
quietly: eststo intervals_5yr: nlcom (intervals_5yr: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** 10 year, regular intervals
clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

gen time = 0 if year==1845
replace time = 1 if year==1855
replace time = 2 if year==1865
replace time = 3 if year==1875
replace time = 4 if year==1885
replace time = 5 if year==1895
replace time = 6 if year==1905
replace time = 7 if year==1915
replace time = 8 if year==1925
replace time = 9 if year==1935
replace time = 10 if year==1945
replace time = 11 if year==1955
replace time = 12 if year==1965
replace time = 13 if year==1975
replace time = 14 if year==1985
replace time = 15 if year==1995
replace time = 16 if year==2005
replace time = 17 if year==2015

keep if time!=.

tsset id time

egen std_indust = std(indust)

quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1, fe robust
quietly: eststo intervals_10yr: nlcom (intervals_10yr: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** 15 year, regular intervals
clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

gen time = 0 if year==1850
replace time = 1 if year==1865
replace time = 2 if year==1880
replace time = 3 if year==1895
replace time = 4 if year==1910
replace time = 5 if year==1925
replace time = 6 if year==1940
replace time = 7 if year==1955
replace time = 8 if year==1970
replace time = 9 if year==1985
replace time = 10 if year==2000
replace time = 11 if year==2015

keep if time!=.

tsset id time

egen std_indust = std(indust)

quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1, fe robust
quietly: eststo intervals_15yr: nlcom (intervals_15yr: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** 20 year, regular intervals
clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

gen time = 0 if year==1855
replace time = 1 if year==1875
replace time = 2 if year==1895
replace time = 3 if year==1915
replace time = 4 if year==1935
replace time = 5 if year==1955
replace time = 6 if year==1975
replace time = 7 if year==1995
replace time = 8 if year==2015

keep if time!=.

tsset id time

egen std_indust = std(indust)

quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1, fe robust
quietly: eststo intervals_20yr: nlcom (intervals_20yr: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** 25 year, regular intervals
clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

gen time = 0 if year==1865
replace time = 1 if year==1890
replace time = 2 if year==1915
replace time = 3 if year==1940
replace time = 4 if year==1965
replace time = 5 if year==1990
replace time = 6 if year==2015

keep if time!=.

tsset id time

egen std_indust = std(indust)

quietly: eststo: xtreg vdem_elec l.vdem_elec l.std_indust l.urbanization i.time if sovereign2==1, fe robust
quietly: eststo intervals_25yr: nlcom (intervals_25yr: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

set scheme   s2mono                     
grstyle init
grstyle set plain, nogrid 

coefplot excl_scandinavia excl_north_west_europe excl_british_offshoots excl_southern_europe excl_eastern_europe excl_balkan excl_ex_ussr excl_north_africa excl_middle_east excl_ssa excl_south_america excl_central_america excl_east_asia excl_southeast_asia excl_south_asia excl_pacific excl_carribean post_1975 post_1945 balanced_1960_2000 global_trend pcse diff_gmm intervals_1yr intervals_5yr intervals_10yr intervals_15yr intervals_20yr intervals_25yr polity lexical boix cheibub universal_suffrage male_suffrage, xline(0) levels(95) nokey msymbol(cicle) mcolor(black) msize(vsmall) lcolor(black) pstyle(p5) mlabel format(%9.2f) mlabposition(2) mlabsize(vsmall) headings(excl_scandinavia="{bf:Excluding:}" post_1975="{bf:Sample:}" global_trend="{bf:Specification:}" intervals_1yr="{bf:Lag length:}" polity="{bf:Alternative democracy indicators:}", labsize(small) labcolor(black)) coeflabels(excl_scandinavia="Scandinavia" excl_north_west_europe="North-West Europe" excl_british_offshoots="UK and British offshoots" excl_southern_europe="Southern Europe" excl_north_africa="North Africa" excl_middle_east="Middle East" excl_south_america="South America"  excl_central_america="Central America" excl_eastern_europe="Eastern Europe" excl_balkan="Balkan" excl_ex_ussr="ex-USSR" excl_ssa="Subsaharan Africa" excl_east_asia="East Asia" excl_southeast_asia="Southeast Asia" excl_south_asia="South Asia" excl_pacific="Pacific" excl_carribean="Carribean" post_1975="Post-1975" post_1945="Post-1945" balanced_1960_2000="Balanced (1960-2000)" global_trend="Time trend, OLS" continent_trend="Continent-specific time trend, OLS"  country_trend="Country-specific time trend, OLS" pcse="PCSE, Prais-Winsten" diff_gmm="Difference-GMM" intervals_1yr="1 year" intervals_5yr="5 year" intervals_10yr="10 year" intervals_15yr="15 year" intervals_20yr="20 year" intervals_25yr="25 year" polity="Combined Polity IV Index (0-10)" vdem_lib="V-dem liberal democracy index (0-10)" universal_suffrage="Universal suffrage (0-1)" male_suffrage= "Male suffrage (0-1)"  polity="Combined Polity IV index (0-10)" lexical="Lexical index (0-6)" boix="Boix et. al. (2013) democracy (0-1)" cheibub="Cheibub et. al. (2010) democracy (0-1)", notick labgap(2) labsize(vsmall))



*=====================================
*	Table A10
*=====================================


clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

/* Subsetting to 5 year intervals */
gen time = 0 if year==1845
replace time = 1 if year==1850
replace time = 2 if year==1855
replace time = 3 if year==1860
replace time = 4 if year==1865
replace time = 5 if year==1870
replace time = 6 if year==1875
replace time = 7 if year==1880
replace time = 8 if year==1885
replace time = 9 if year==1890
replace time = 10 if year==1895
replace time = 11 if year==1900
replace time = 12 if year==1905
replace time = 13 if year==1910
replace time = 14 if year==1915
replace time = 15 if year==1920
replace time = 16 if year==1925
replace time = 17 if year==1930
replace time = 18 if year==1935
replace time = 19 if year==1940
replace time = 20 if year==1945
replace time = 21 if year==1950
replace time = 22 if year==1955
replace time = 23 if year==1960
replace time = 24 if year==1965
replace time = 25 if year==1970
replace time = 26 if year==1975
replace time = 27 if year==1980
replace time = 28 if year==1985
replace time = 29 if year==1990
replace time = 30 if year==1995
replace time = 31 if year==2000
replace time = 32 if year==2005
replace time = 33 if year==2010
replace time = 34 if year==2015

keep if time!=.

tsset id time

gen unido_x = unido_employees / (mad_pop/100)

egen std_indust = std(unido_x)
egen std_gini = std(gini)
egen std_years_edu = std(years_edu)
egen std_vdem_equality = std(v2xeg_eqdr)
egen std_ln_gdp = std(ln_gdp)
egen std_urbanization = std(urbanization)
egen std_oil_gdp = std(oil_gdp)
egen std_region_vdem_lib = std(region_vdem_lib)
egen std_trade = std(trade)
egen std_property_rights = std(property_rights )
egen std_breakdowns = std(e_democracy_breakdowns)
egen std_duration_regime = std(duration_regime)
egen std_state_ownership = std(state_ownership)
egen std_gdp_growth = std(gdp_growth)
egen std_pop_15_64 = std(pop_15_64)
gen ln_pop_15_65 = ln(pop_15_64)
egen std_ln_pop_15_65 = std(ln_pop_15_65)
egen std_political_cor = std(political_cor)
egen std_mva_gdp = std(mva_gdp)
egen std_min_empl = std(min_empl)
egen std_literacy = std(literacy)
gen ln_pop = ln(pop)
egen std_ln_pop = std(ln_pop)

gen l1_std_indust = l.std_indust

estimates clear

** Column 1 -- Bivariate
quietly: eststo sr_m1: xtreg vdem_elec l.vdem_elec l1_std_indust i.time if sovereign2==1, fe robust
quietly: eststo lr_m1: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

** Column 2 -- GDP per capita and inequality
quietly: eststo sr_m2: xtreg vdem_elec l.vdem_elec l1_std_indust l.std_vdem_equality l.std_ln_gdp l.std_years_edu l.std_urbanization i.time if sovereign2==1, fe robust
quietly: eststo delta_m2: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)
quietly: eststo lr_m2: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

** Column 3 -- Oil rents, and democracy in the region
quietly: eststo sr_m3: xtreg vdem_elec l.vdem_elec l1_std_indust l1.std_oil_gdp l1.std_breakdowns l1.recession i.time if sovereign2==1, fe robust
quietly: eststo delta_m3: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)
quietly: eststo lr_m3: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

** Column 4 -- Trade and past reversals
quietly: eststo sr_m4: xtreg vdem_elec l.vdem_elec l1_std_indust l1.std_duration_regime l1.std_property_rights l1.std_trade i.time if sovereign2==1, fe robust
quietly: eststo delta_m4: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)
quietly: eststo lr_m4: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

** Column 5 --  Western alignment and warfare
quietly: eststo sr_m5: xtreg vdem_elec l.vdem_elec l1_std_indust l1.democracy_after_autconst l1.std_state_ownership l1.std_political_cor i.time if sovereign2==1, fe robust
quietly: eststo delta_m5: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)
quietly: eststo lr_m5: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

** Column 6 -- Duration regime, GDP growth, and state ownership
quietly: eststo sr_m6: xtreg vdem_elec l.vdem_elec l1_std_indust l1.western_align l1.inter_war l1.intra_war i.time if sovereign2==1, fe robust
quietly: eststo delta_m6: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)
quietly: eststo lr_m6: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

estout sr_m1 sr_m2 sr_m3 sr_m4 sr_m5 sr_m6, cells(b(star fmt(3)) se(par fmt(3))) legend stats(oster_delta N N_g, fmt(%7.1f %7.0f %7.0f)) starlevels(* 0.05 ** 0.01 *** 0.001) drop(*time*) 
estout delta_m2 delta_m3 delta_m4 delta_m5 delta_m6, legend label stats(delta, fmt(%7.1f)) keep(*_cons*)
estout lr_m1 lr_m2 lr_m3 lr_m4 lr_m5 lr_m6, cells(b(star fmt(3)) se(par fmt(3))) starlevels(* 0.05 ** 0.01 *** 0.001) legend label 


*=====================================
*	Table A12
*=====================================

clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

/* Subsetting to 5 year intervals */
gen time = 0 if year==1845
replace time = 1 if year==1850
replace time = 2 if year==1855
replace time = 3 if year==1860
replace time = 4 if year==1865
replace time = 5 if year==1870
replace time = 6 if year==1875
replace time = 7 if year==1880
replace time = 8 if year==1885
replace time = 9 if year==1890
replace time = 10 if year==1895
replace time = 11 if year==1900
replace time = 12 if year==1905
replace time = 13 if year==1910
replace time = 14 if year==1915
replace time = 15 if year==1920
replace time = 16 if year==1925
replace time = 17 if year==1930
replace time = 18 if year==1935
replace time = 19 if year==1940
replace time = 20 if year==1945
replace time = 21 if year==1950
replace time = 22 if year==1955
replace time = 23 if year==1960
replace time = 24 if year==1965
replace time = 25 if year==1970
replace time = 26 if year==1975
replace time = 27 if year==1980
replace time = 28 if year==1985
replace time = 29 if year==1990
replace time = 30 if year==1995
replace time = 31 if year==2000
replace time = 32 if year==2005
replace time = 33 if year==2010
replace time = 34 if year==2015

keep if time!=.

tsset id time

egen std_min_emp = std(min_emp)
egen std_constr_emp = std(constr_emp)
egen std_agri_emp = std(agri_emp)
egen std_indust = std(indust)
egen std_mva_pc = std(mva_pc)
egen std_mva_gdp = std(mva_gdp)

estimates clear

** Column 1 -- Bivariate
quietly: eststo sr_m1: xtreg vdem_elec l.vdem_elec l.std_indust i.time if sovereign2==1, fe robust
quietly: eststo lr_m1: nlcom (nlx: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Column 2 -- Agricultural employment
quietly: eststo sr_m2: xtreg vdem_elec l.vdem_elec l.std_indust l.std_agri_emp i.time if sovereign2==1, fe robust
quietly: eststo lr_m2: nlcom (nlx: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Column 3 -- Construction employment
quietly: eststo sr_m3: xtreg vdem_elec l.vdem_elec l.std_indust l.std_constr_emp i.time if sovereign2==1, fe robust
quietly: eststo lr_m3: nlcom (nlx: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Column 4 -- Mining employment
quietly: eststo sr_m4: xtreg vdem_elec l.vdem_elec l.std_indust l.std_min_emp i.time if sovereign2==1, fe robust
quietly: eststo lr_m4: nlcom (nlx: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Column 5 -- MVA per capita
quietly: eststo sr_m5: xtreg vdem_elec l.vdem_elec l.std_indust l.std_mva_pc i.time if sovereign2==1, fe robust
quietly: eststo lr_m5: nlcom (nlx: _b[l.std_indust]/(1-_b[l.vdem_elec])), post

** Column 6 -- MVA as % of GDP
quietly: eststo sr_m6: xtreg vdem_elec l.vdem_elec l.std_indust l.std_mva_gdp i.time if sovereign2==1, fe robust
quietly: eststo lr_m6: nlcom (nlx: _b[l.std_indust]/(1-_b[l.vdem_elec])), post


estout sr_m1 sr_m2 sr_m3 sr_m4 sr_m5 sr_m6, cells(b(star fmt(3)) se(par fmt(3))) legend stats(oster_delta N N_g, fmt(%7.1f %7.0f %7.0f)) starlevels(* 0.15 ** 0.05 *** 0.01) drop(*time*) 
estout lr_m1 lr_m2 lr_m3 lr_m4 lr_m5 lr_m6, cells(b(star fmt(3)) se(par fmt(3))) starlevels(* 0.15 ** 0.05 *** 0.01) legend label 


*=====================================
*	Table A13
*===================================== 

clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data"
use "Industrialization and democracy final data (with variables recoded)"

/* Creating 5 year averages */
bys id: gen period = 5 * floor(year/5)
collapse vdem_elec sovereign2 indust gini years_edu v2xeg_eqdr ln_gdp urbanization oil_gdp region_vdem_lib trade property_rights e_democracy_breakdowns duration_regime state_ownership gdp_growth pop_15_64 political_cor mva_gdp min_empl literacy pop recession democracy_after_autconst western_align inter_war intra_war, by (id period country_name)

bys id: gen time = _n

tsset id time

xi i.period

egen std_indust = std(indust)
egen std_gini = std(gini)
egen std_years_edu = std(years_edu)
egen std_vdem_equality = std(v2xeg_eqdr)
egen std_ln_gdp = std(ln_gdp)
egen std_urbanization = std(urbanization)
egen std_oil_gdp = std(oil_gdp)
egen std_region_vdem_lib = std(region_vdem_lib)
egen std_trade = std(trade)
egen std_property_rights = std(property_rights )
egen std_breakdowns = std(e_democracy_breakdowns)
egen std_duration_regime = std(duration_regime)
egen std_state_ownership = std(state_ownership)
egen std_gdp_growth = std(gdp_growth)
egen std_pop_15_64 = std(pop_15_64)
gen ln_pop_15_65 = ln(pop_15_64)
egen std_ln_pop_15_65 = std(ln_pop_15_65)
egen std_political_cor = std(political_cor)
egen std_mva_gdp = std(mva_gdp)
egen std_min_empl = std(min_empl)
egen std_literacy = std(literacy)
gen ln_pop = ln(pop)
egen std_ln_pop = std(ln_pop)

gen l1_std_indust = l.std_indust

estimates clear

** Column 1 -- Bivariate
quietly: eststo sr_m1: xtreg vdem_elec l.vdem_elec l1_std_indust i.time if sovereign2==1, fe robust
quietly: eststo lr_m1: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

** Column 2 -- GDP per capita and inequality
quietly: eststo sr_m2: xtreg vdem_elec l.vdem_elec l1_std_indust l.std_vdem_equality l.std_ln_gdp l.std_years_edu l.std_urbanization i.time if sovereign2==1, fe robust
quietly: eststo delta_m2: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)
quietly: eststo lr_m2: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

** Column 3 -- Oil rents, and democracy in the region
quietly: eststo sr_m3: xtreg vdem_elec l.vdem_elec l1_std_indust l1.std_oil_gdp l1.std_breakdowns l1.recession i.time if sovereign2==1, fe robust
quietly: eststo delta_m3: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)
quietly: eststo lr_m3: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

** Column 4 -- Trade and past reversals
quietly: eststo sr_m4: xtreg vdem_elec l.vdem_elec l1_std_indust l1.std_duration_regime l1.std_property_rights l1.std_trade i.time if sovereign2==1, fe robust
quietly: eststo delta_m4: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)
quietly: eststo lr_m4: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

** Column 5 --  Western alignment and warfare
quietly: eststo sr_m5: xtreg vdem_elec l.vdem_elec l1_std_indust l1.democracy_after_autconst l1.std_state_ownership l1.std_political_cor i.time if sovereign2==1, fe robust
quietly: eststo delta_m5: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)
quietly: eststo lr_m5: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

** Column 6 -- Duration regime, GDP growth, and state ownership
quietly: eststo sr_m6: xtreg vdem_elec l.vdem_elec l1_std_indust l1.western_align l1.inter_war l1.intra_war i.time if sovereign2==1, fe robust
quietly: eststo delta_m6: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)
quietly: eststo lr_m6: nlcom (nlx: _b[l1_std_indust]/(1-_b[l.vdem_elec])), post

estout sr_m1 sr_m2 sr_m3 sr_m4 sr_m5 sr_m6, cells(b(star fmt(3)) se(par fmt(3))) legend stats(oster_delta N N_g, fmt(%7.1f %7.0f %7.0f)) starlevels(* 0.05 ** 0.01 *** 0.001) drop(*time*) 
estout delta_m2 delta_m3 delta_m4 delta_m5 delta_m6, legend label stats(delta, fmt(%7.1f)) keep(*_cons*)
estout lr_m1 lr_m2 lr_m3 lr_m4 lr_m5 lr_m6, cells(b(star fmt(3)) se(par fmt(3))) starlevels(* 0.05 ** 0.01 *** 0.001) legend label 


*=====================================
*	Table A14
*===================================== 

clear
cd "/Users/sv5011/Desktop/Work/Papers/Working papers/1_Industrialization and Democracy/1_Data" 
use "Industrialization and democracy final data (with variables recoded)"

/* Subsetting to 5 year intervals */
gen time = 0 if year==1845
replace time = 1 if year==1850
replace time = 2 if year==1855
replace time = 3 if year==1860
replace time = 4 if year==1865
replace time = 5 if year==1870
replace time = 6 if year==1875
replace time = 7 if year==1880
replace time = 8 if year==1885
replace time = 9 if year==1890
replace time = 10 if year==1895
replace time = 11 if year==1900
replace time = 12 if year==1905
replace time = 13 if year==1910
replace time = 14 if year==1915
replace time = 15 if year==1920
replace time = 16 if year==1925
replace time = 17 if year==1930
replace time = 18 if year==1935
replace time = 19 if year==1940
replace time = 20 if year==1945
replace time = 21 if year==1950
replace time = 22 if year==1955
replace time = 23 if year==1960
replace time = 24 if year==1965
replace time = 25 if year==1970
replace time = 26 if year==1975
replace time = 27 if year==1980
replace time = 28 if year==1985
replace time = 29 if year==1990
replace time = 30 if year==1995
replace time = 31 if year==2000
replace time = 32 if year==2005
replace time = 33 if year==2010
replace time = 34 if year==2015

keep if time!=.

tsset id time

egen std_indust = std(indust)
egen std_gini = std(gini)
egen std_years_edu = std(years_edu)
egen std_vdem_equality = std(v2xeg_eqdr)
egen std_ln_gdp = std(ln_gdp)
egen std_urbanization = std(urbanization)
egen std_oil_gdp = std(oil_gdp)
egen std_region_vdem_lib = std(region_vdem_lib)
egen std_trade = std(trade)
egen std_property_rights = std(property_rights )
egen std_breakdowns = std(e_democracy_breakdowns)
egen std_duration_regime = std(duration_regime)
egen std_state_ownership = std(state_ownership)
egen std_gdp_growth = std(gdp_growth)
egen std_pop_15_64 = std(pop_15_64)
gen ln_pop_15_65 = ln(pop_15_64)
egen std_ln_pop_15_65 = std(ln_pop_15_65)
egen std_political_cor = std(political_cor)
egen std_mva_gdp = std(mva_gdp)
egen std_min_empl = std(min_empl)
egen std_literacy = std(literacy)
gen ln_pop = ln(pop)
egen std_ln_pop = std(ln_pop)

gen l1_std_indust = l.std_indust

estimates clear

** Column 1 -- Bivariate
quietly: eststo m1: xtreg vdem_elec  l1_std_indust i.time if sovereign2==1, fe robust

** Column 2 -- GDP per capita and inequality
quietly: eststo m2: xtreg vdem_elec l1_std_indust l.std_vdem_equality l.std_ln_gdp l.std_years_edu l.std_urbanization i.time if sovereign2==1, fe robust
quietly: eststo delta_m2: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)

** Column 3 -- Oil rents, and democracy in the region
quietly: eststo m3: xtreg vdem_elec l1_std_indust l1.std_oil_gdp l1.std_breakdowns l1.recession i.time if sovereign2==1, fe robust
quietly: eststo delta_m3: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)

** Column 4 -- Trade and past reversals
quietly: eststo m4: xtreg vdem_elec l1_std_indust l1.std_duration_regime l1.std_property_rights l1.std_trade i.time if sovereign2==1, fe robust
quietly: eststo delta_m4: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)

** Column 5 --  Western alignment and warfare
quietly: eststo m5: xtreg vdem_elec l1_std_indust l1.democracy_after_autconst l1.std_state_ownership l1.std_political_cor i.time if sovereign2==1, fe robust
quietly: eststo delta_m5: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)

** Column 6 -- Duration regime, GDP growth, and state ownership
quietly: eststo m6: xtreg vdem_elec l1_std_indust l1.western_align l1.inter_war l1.intra_war i.time if sovereign2==1, fe robust
quietly: eststo delta_m6: psacalc delta l1_std_indust, rmax(1)
quietly: estadd scalar delta = r(delta)

estout m1 m2 m3 m4 m5 m6, cells(b(star fmt(3)) se(par fmt(3))) legend stats(oster_delta N N_g, fmt(%7.1f %7.0f %7.0f)) starlevels(* 0.05 ** 0.01 *** 0.001) drop(*time*) 
estout delta_m2 delta_m3 delta_m4 delta_m5 delta_m6, legend label stats(delta, fmt(%7.1f)) keep(*_cons*)

